Ticket #650: putnobody.patch
-
_cprequest.py
old new 1 """CherryPy core request/response handling."""2 1 3 2 import Cookie 4 3 import os … … 643 642 644 643 def process_body(self): 645 644 """Convert request.rfile into request.params (or request.body).""" 645 if not self.headers.get("Content-Length", ""): 646 # No Content-Length header supplied (or it's 0). 647 # If we went ahead and called cgi.FieldStorage, it would hang, 648 # since it cannot determine when to stop reading from the socket. 649 # See http://www.cherrypy.org/ticket/493. 650 # See also http://www.cherrypy.org/ticket/650. 651 # Note also that we expect any HTTP server to have decoded 652 # any message-body that had a transfer-coding, and we expect 653 # the HTTP server to have supplied a Content-Length header 654 # which is valid for the decoded entity-body. 655 return 656 646 657 # FieldStorage only recognizes POST, so fake it. 647 658 methenv = {'REQUEST_METHOD': "POST"} 648 659 try: -
wsgiserver/__init__.py
old new 267 267 if read_chunked: 268 268 if not self.decode_chunked(): 269 269 return 270 else:271 cl = environ.get("CONTENT_LENGTH")272 if method in ("POST", "PUT") and cl is None:273 # No Content-Length header supplied. This will hang274 # cgi.FieldStorage, since it cannot determine when to275 # stop reading from the socket.276 # See http://www.cherrypy.org/ticket/493.277 self.simple_response("411 Length Required")278 return279 270 280 271 # From PEP 333: 281 272 # "Servers and gateways that implement HTTP 1.1 must provide

