#2131: [patch] HttpResponseSendFile for serving static files handler-specific
sendfile mechanism
-----------------------------------------------+----------------------------
          Reporter:  ymasuda[at]ethercube.com  |         Owner:  alsleme 
            Status:  new                       |     Milestone:  1.1 beta
         Component:  Core framework            |       Version:  SVN     
        Resolution:                            |      Keywords:          
             Stage:  Accepted                  |     Has_patch:  1       
        Needs_docs:  1                         |   Needs_tests:  1       
Needs_better_patch:  1                         |  
-----------------------------------------------+----------------------------
Comment (by mrts):

 As far as I can see, `HttpResponseSendFile` should not mimic
 `HttpResponse` in the sense that it should always be specially handled.
 Ordinary `HttpResponse` can take a file object in the `content` parameter
 already and serve the file from within Python, so that behaviour should be
 explicitly disallowed in `HttpResponseSendFile`.

 Attaching a patch that does exactly this, i.e. doesn't `open()` the file
 and passes `None` as `content` to parent constructor to make it explicit
 that the content is neither a string nor can be handled with the default
 behaviour. I'm not sure about the ''Content-Length'' header though, I've
 currently added it to be compatible with
 `ServerHandler.cleanup_headers()`, but it may need more thought.

 Btw, how `mod_python` handles `req.sendfile` can be seen here:
 
https://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk/src/requestobject.c
 .

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2131#comment:33>
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 django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to