Google Groups Home
Help | Sign in
#811: CP WSGI requires a full read of request body
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
CherryPy  
View profile
 More options May 6, 4:26 pm
From: CherryPy <t...@cherrypy.org>
Date: Tue, 06 May 2008 20:26:24 -0000
Local: Tues, May 6 2008 4:26 pm
Subject: [CherryPy] #811: CP WSGI requires a full read of request body

#811: CP WSGI requires a full read of request body
---------------------------+----------------------------------------------- -
 Reporter:  guest          |       Owner:  fumanchu
     Type:  defect         |      Status:  new    
 Priority:  normal         |   Milestone:          
Component:  CherryPy code  |    Keywords:          
---------------------------+----------------------------------------------- -
 If a request body is not read then it is prepended to the REQUEST_METHOD
 of the following request.

 {{{
 #!/usr/bin/python
 # encoding: utf-8

 import cherrypy.wsgiserver as wsgiserver
 from webob import Request, Response

 def wsgi_app(environ, start_response):
     print environ['REQUEST_METHOD']
     request = Request(environ)

     print request.method

     # FIXME: force a read of the request body (workaround for CherryPy)
     # request.body

     response = Response(body="<html><body><form method='post'><input
 name='aaa' /></form></body></html>")
     return response(environ, start_response)

 server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 8080), wsgi_app)

 if __name__ == '__main__':
     try:
         server.start()
     except KeyboardInterrupt:
         server.stop()
 }}}

 The first POST is OK, the second one has the body of the previous post
 prepended to the request method:

 Console output:
 {{{GET
 GET
 POST
 POST
 aaa=aaaaaPOST
 aaa=aaaaaPOST
 }}}

 Forcing a full read of the body gives a workaround for the problem.

 (rev-1956 and 3.1.0-beta3)

--
Ticket URL: <http://www.cherrypy.org/ticket/811>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CherryPy  
View profile
 More options May 6, 4:28 pm
From: CherryPy <t...@cherrypy.org>
Date: Tue, 06 May 2008 20:28:47 -0000
Local: Tues, May 6 2008 4:28 pm
Subject: Re: [CherryPy] #811: CP WSGI requires a full read of request body

#811: CP WSGI requires a full read of request body
---------------------------+----------------------------------------------- -
 Reporter:  guest          |        Owner:  fumanchu
     Type:  defect         |       Status:  new    
 Priority:  normal         |    Milestone:          
Component:  CherryPy code  |   Resolution:          
 Keywords:                 |  
---------------------------+----------------------------------------------- -
Changes (by guest):

  * cc:  => pstradom...@gmail.com

--
Ticket URL: <http://www.cherrypy.org/ticket/811>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CherryPy  
View profile
 More options Jun 6, 5:56 pm
From: CherryPy <t...@cherrypy.org>
Date: Fri, 06 Jun 2008 21:56:58 -0000
Local: Fri, Jun 6 2008 5:56 pm
Subject: Re: [CherryPy] #811: CP WSGI requires a full read of request body

#811: CP WSGI requires a full read of request body
------------------------+-------------------------------------------------- -
 Reporter:  guest       |        Owner:  fumanchu
     Type:  defect      |       Status:  new    
 Priority:  normal      |    Milestone:          
Component:  wsgiserver  |   Resolution:          
 Keywords:              |  
------------------------+-------------------------------------------------- -
Changes (by guest):

  * component:  CherryPy code => wsgiserver

--
Ticket URL: <http://www.cherrypy.org/ticket/811>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CherryPy  
View profile
 More options Jun 29, 3:31 pm
From: CherryPy <t...@cherrypy.org>
Date: Sun, 29 Jun 2008 19:31:37 -0000
Local: Sun, Jun 29 2008 3:31 pm
Subject: Re: [CherryPy] #811: CP WSGI requires a full read of request body

#811: CP WSGI requires a full read of request body
------------------------+-------------------------------------------------- -
 Reporter:  guest       |        Owner:  fumanchu  
     Type:  defect      |       Status:  closed    
 Priority:  normal      |    Milestone:  3.1      
Component:  wsgiserver  |   Resolution:  worksforme
 Keywords:              |  
------------------------+-------------------------------------------------- -
Changes (by fumanchu):

  * milestone:  => 3.1
  * resolution:  => worksforme
  * status:  new => closed

Comment:

 Hmmm. Your demo works fine for me with CP trunk and webob trunk. Since
 [1786] HTTPRequest.send_headers has said:

 {{{
 #!python
 if (not self.close_connection) and (not self.chunked_read):
     # Read any remaining request body data on the socket.
 }}}

 I wonder how you're avoiding that. It's probably not that close_connection
 is True, because in that case the second request would be on its own conn.
 Are you doing chunked reads? That seems highly unlikely, but even if you
 were, wsgiserver currently reads the entire body into a StringIO before
 calling the app. I'm baffled.

--
Ticket URL: <http://www.cherrypy.org/ticket/811>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google