[Django] #9054: request.raw_post_data is empty for multipart/related posts

View: New views
8 Messages — Rating Filter:   Alert me  

[Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
---------------------------+------------------------------------------------
 Reporter:  gruffudd       |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  HTTP handling  |     Version:  1.0      
 Keywords:  multipart      |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 core/handlers/wsgi.py : request.raw_post_data is set to empty string if
 the request self.environ.get('CONTENT_TYPE', '').startswith('multipart').

 This is probably ok for multipart/form-data (file upload), but I don't
 think it is correct for all multipart subtypes, specifically
 multipart/related, in which message parts should not be considered
 individually but rather as parts of an aggregate whole :
 http://en.wikipedia.org/wiki/MIME#Related

 request.raw_post_data was set correctly in 0.97 but not in 1.0.

 A specific example is posting a SOAP/ebXML multipart/related message.

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Unreviewed     |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Changes (by gruffudd):

  * needs_better_patch:  => 0
  * has_patch:  0 => 1
  * needs_tests:  => 0
  * needs_docs:  => 0

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Unreviewed     |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by chris chamberlin):

 The mod_python handler has this same bug.

 Another way this bug manifests itself: If I access the raw_post_data
 attribute first, the POST dict will be empty, even for multipart/form-
 data.  As it stands, you can get your data either in POST or
 raw_post_data, but not both.  Access to both is useful; I wrote middleware
 to mirror certain POST requests to another location, but it triggers this
 bug.

 My inexpert assessment is that this bug results from changing
 django.http.HttpRequest.parse_file_upload() to take a file-like object (so
 it can read chunks), instead of taking the entire request content from
 raw_post_data as it was done pre-1.0.

 An upload handler might help with a workaround?

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Unreviewed     |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by chris chamberlin ):

 The patch attached just above seems to make it safe to peek at
 raw_post_data before the POST dict is generated, regardless of what the
 content-type is. It doesn't entirely fix the issue; you still can't access
 the attributes in reverse order; after you get POST, raw_post_data will be
 empty.

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Unreviewed     |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by mristroph):

 I just applied Chris' patch and it works as described. Thanks, Chris! I
 had same problem with the POST QueryDict being empty in views after
 accessing the raw_post_data in a decorator.

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Accepted       |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Changes (by ericholscher):

  * stage:  Unreviewed => Accepted

Comment:

 Marking as accepted since it has been reported by multiple people.

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Accepted       |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Changes (by Uninen):

 * cc: ville@... (added)

Comment:

 This is possibly related to #3211.

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


Re: [Django] #9054: request.raw_post_data is empty for multipart/related posts

by noreply-71 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

#9054: request.raw_post_data is empty for multipart/related posts
------------------------------------+---------------------------------------
          Reporter:  gruffudd       |         Owner:  nobody  
            Status:  new            |     Milestone:          
         Component:  HTTP handling  |       Version:  1.0      
        Resolution:                 |      Keywords:  multipart
             Stage:  Accepted       |     Has_patch:  1        
        Needs_docs:  0              |   Needs_tests:  0        
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Comment (by peterbe):

 For what it's worth, I suffered too until I applied the wsgi.py patch and
 then I was able to have multipart/related SOAP posts posted to my app.

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