Opened 15 years ago

Closed 15 years ago

#12788 closed (duplicate)

ConditionalGetMiddleware behavior improvement.

Reported by: penzoil <fredericbochmann@…> Owned by: nobody
Component: Core (Cache system) Version: dev
Severity: Keywords: ConditionalGetMiddleware, ETag
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This patch is intended to improve the behavior of the django.middleware.http.ConditionalGetMiddleware middleware. When a particular django view has at least two decorators that work with redirecting behavior, Firefox will send a ETag that seems to be valid since the response is nothing more than a Location redirect, thus the content-length is 0 and the ETag is valid for the two steps created by the two decorators that redirect the user to different pages (Example decorator : @login_required and another that acts very similarly).
The bug is that the browser will receive a Not Modified header once the users passes the first decorator when he gets redirected by to the original view.

The FIX: The fix changes the behavior of the django.middleware.http.ConditionalGetMiddleware to not send a 304 response code if the content-length is 0 or undefined.

I'm not sure if it's proper, but it seems good of a fix and it actually fixes my issue.
So, I just wanted to shared it, hopefully it can make it in the code-base.

Attachments (3)

fix_middleware_http.diff (1.0 KB ) - added by penzoil <fredericbochmann@…> 15 years ago.
fix_middleware_http.2.diff (1.0 KB ) - added by penzoil <fredericbochmann@…> 15 years ago.
fix_middleware_http.3.diff (1.0 KB ) - added by penzoil <fredericbochmann@…> 15 years ago.

Download all attachments as: .zip

Change History (7)

by penzoil <fredericbochmann@…>, 15 years ago

Attachment: fix_middleware_http.diff added

by penzoil <fredericbochmann@…>, 15 years ago

Attachment: fix_middleware_http.2.diff added

by penzoil <fredericbochmann@…>, 15 years ago

Attachment: fix_middleware_http.3.diff added

comment:1 by penzoil <fredericbochmann@…>, 15 years ago

Sorry for attaching the file 3 times, I just couldn't see it display properly in the preview tool. If you download the original format, the file is good.

comment:2 by penzoil, 15 years ago

I was wondering if it would be possible to remove my email from the ticket and the comments / change history/ attachements. And possibly this comment that is asking this. If not, oh well.

comment:3 by penzoil, 15 years ago

Actually, can you DROP this ticket please, I created another one which doesn't contain my email all over.

http://code.djangoproject.com/ticket/12789

comment:4 by Russell Keith-Magee, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #12789

Note: See TracTickets for help on using tickets.
Back to Top