#5897: Add Content-Length header in common middleware
---------------------------------------------------------------+------------
          Reporter:  Scott Barr <[email protected]>  |         Owner: 
 ccahoon                  
            Status:  new                                       |     Milestone: 
                          
         Component:  HTTP handling                             |       Version: 
 SVN                      
        Resolution:                                            |      Keywords: 
 Content-Length middleware
             Stage:  Design decision needed                    |     Has_patch: 
 1                        
        Needs_docs:  0                                         |   Needs_tests: 
 0                        
Needs_better_patch:  0                                         |  
---------------------------------------------------------------+------------
Comment (by ccahoon):

 Three things:
 * This does not interfere with HttpResponseSendFile, which bypasses
 response middleware.
 * Content-Length is a SHOULD in the HTTP/1.0 and HTTP/1.1 specs.
 [http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#Content-
 Length / HTTP1.0, Content-Length.]
 [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 /HTTP1.1,
 Content-Length]
 * As noted by grahamd, Content-Length is not required by WSGI either (in
 the response). http://code.djangoproject.com/ticket/7581#comment:12

 That said, I am going to investigate further. This is closely related to
 #7581, which incidentally has a very similar bit of code to the patch
 provided here.

 When dealing with streaming responses, probably intended for chunked
 transfer encoding, we want to ensure that we don't consume the whole
 generator/iterator in any effort to send a header that is not strictly
 required.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5897#comment:6>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to