#2131: HttpResponseSendFile for serving static files handler-specific sendfile
mechanism
-----------------------------------------------+----------------------------
Reporter: ymasuda[at]ethercube.com | Owner: ccahoon
Status: new | Milestone:
Component: Core framework | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
-----------------------------------------------+----------------------------
Comment (by anonymous):
Replying to [comment:27 jacob]:
> Looks good. I'd like to see support for `X-SendFile` baked in. This
should be too hard to do: instead of storing the file name in
`self.sendfile_filename`, store it in an `X-SendFile` header. Then we just
need a small piece of middleware -- or, perhaps, something added to the
common middleware? -- that responds to a setting
(`SERVER_SUPPORTS_X_SENDFILE` or somesuch) and returns the response with
the header and an empty body.
Testing the current patch, the "baked in" x-sendfile support breaks the
feature. I see both wsgi and x-sendfile messages in the log, for the same
file. I suspect something like the following: due to the header, apache
discards the returned content (the file wsgi is supposed to be serving),
and tries to serve the file itself via mod_xsendfile. In my config the
wsgi daemon has permission to read the file, but the "apache" user does
not, so xsendfile fails. If your user "apache" has permission to read the
file, you probably won't see the bug, but behind the scenes the file is
being read twice (discarded the first time).
Disabling mod_xsendfile allows it to work. It's worth reiterating that
x-sendfile does not work if the main apache user does not have permission
to read the file. A solution is sorely needed for serving files in the
context of wsgi.
--
Ticket URL: <http://code.djangoproject.com/ticket/2131#comment:87>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.