#22904: Django returns an HTTP 200 on a HEAD request for a non-existing file in 
the
media folder
-------------------------------------+-------------------------------------
     Reporter:  sHtev                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  File                 |                  Version:  1.7
  uploads/storage                    |
     Severity:  Normal               |               Resolution:
     Keywords:  staticfiles HEAD     |             Triage Stage:
  request HTTP                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by jrief):

 * status:  closed => new
 * version:  1.5 => 1.7
 * resolution:  needsinfo =>


Comment:

 I also can replicate this bug. It happens on Django version 1.6 and 1.7. I
 haven't tested with 1.8 yet.

 In order to repeat you have to use any URL in the {{{/media/...}}} path
 **AND** the sessionid must be from a logged in staff user.

 {{{
 $ curl --head --cookie sessionid=<valid-session-id-of-staff-user>
 http://localhost:8000/media/path-to-non-exiting-file
 HTTP/1.0 200 OK

 $ curl --include --cookie sessionid=<valid-session-id-of-staff-user>
 http://localhost:8000/media/path-to-non-exiting-file
 HTTP/1.0 404 NOT FOUND

 $ curl --head --cookie sessionid=<invalid-session-id>
 http://localhost:8000/media/path-to-non-exiting-file
 HTTP/1.0 404 NOT FOUND

 $ curl --head http://localhost:8000/media/path-to-non-exiting-file
 HTTP/1.0 404 NOT FOUND

 $ curl --head --cookie sessionid=<valid-session-id-of-staff-user>
 http://localhost:8000/static/path-to-non-exiting-file
 HTTP/1.0 404 NOT FOUND
 }}}

 what we see here is, that only the first invocation of **curl** delivers
 an unexpected result. All others are correct.

 Of course this only happens with {{{DEBUG = True}}} and while delivering
 media files through Django. Otherwise we'd have to blame Apache or NGiNX.

--
Ticket URL: <https://code.djangoproject.com/ticket/22904#comment:10>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.d2637ee958867c6f2b29bcc6be2b7709%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to