#2504: ConditionalGetMiddleware causes Content-Length to be 0 on HttpResponse 
with
fileobject
---------------------------------+------------------------------------------
   Reporter:  [EMAIL PROTECTED]  |                Owner:  frasern       
     Status:  assigned           |            Component:  Core framework
    Version:  SVN                |           Resolution:                
   Keywords:                     |                Stage:  Accepted      
  Has_patch:  1                  |           Needs_docs:  0             
Needs_tests:  0                  |   Needs_better_patch:  0             
---------------------------------+------------------------------------------
Comment (by arne):

 I create tar files on the fly with os.popen2() and pass stdout, which is a
 fileobj, as response.content, doing a len(response.content) reads the
 full tar file into memory, which can be > 500MB in my case. Without
 checking for the content length everything works fine and I can do a
 "streaming" download to the browser ...

 As a workaroung I have patched my django tree and added the following two
 lines at the top of process_response() in the ConditionalGetMiddleware:


 {{{
 if(response._is_string == False):
     return response
 }}}


 This may not be fully HTTP compatible, but I see no other way of sending
 large files without creating temp-files ...

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2504#comment:9>
Django Code <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