#30812: ConditionalGetMiddleware returns 304 if ETag is the same but 
Last-Modified
has changed.
-------------------------------------+------------------------------------
     Reporter:  Flavio Curella       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+------------------------------------
Changes (by felixxm):

 * version:  2.2 => master
 * stage:  Unreviewed => Accepted


Old description:

> split from https://code.djangoproject.com/ticket/29241

New description:

 ConditionalGetMiddleware in combination with apache x-sendfile (django-
 sendfile) doesn't work properly.

 Each response gets a ETag generated based on response.content which is an
 empty string in the case of a x-sendfile response, so each time the file
 is accessed, the ETag generated by `ConditionalGetMiddleware` is the same.
 Regardless of the changed file/changed mtime. In
 `get_conditional_response()` the ETag (which is always the same hash of
 empty string) is checked first and returns a 304 because it ignores `Last-
 Modified` time. Django shouldn't return 304 if ETag is the same but `Last-
 Modified` has changed.

 Related with #29241.

--

Comment:

 Thanks for the ticket (please try to add more descriptive description in
 the future).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30812#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.4a43a9f0769807fe3308156dd1485e6d%40djangoproject.com.

Reply via email to