--- a/components/python/cherrypy/patches/cp-ticket-847.patch Mon Jan 09 02:09:07 2017 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-Index: cherrypy/wsgiserver/__init__.py
-===================================================================
---- cherrypy/wsgiserver/__init__.py (revision 2459)
-+++ cherrypy/wsgiserver/__init__.py (working copy)
-@@ -291,6 +291,7 @@
- self.wsgi_app = wsgi_app
-
- self.ready = False
-+ self.started_request = False
- self.started_response = False
- self.status = ""
- self.outheaders = []
-@@ -318,6 +319,9 @@
- # (although your TCP stack might suffer for it: cf Apache's history
- # with FIN_WAIT_2).
- request_line = self.rfile.readline()
-+ # Set started_request to True so communicate() knows to send 408
-+ # from here on out.
-+ self.started_request = True
- if not request_line:
- # Force self.ready = False so the connection will close.
- self.ready = False
-@@ -1169,6 +1173,9 @@
- # This order of operations should guarantee correct pipelining.
- req.parse_request()
- if not req.ready:
-+ # Something went wrong in the parsing (and the server has
-+ # probably already made a simple response). Return and
-+ # let the conn close.
- return
-
- req.respond()
-@@ -1178,7 +1185,10 @@
- except socket.error, e:
- errnum = e.args[0]
- if errnum == 'timed out':
-- if req and not req.sent_headers:
-+ # Don't send a 408 if there is no oustanding request; only
-+ # if we're in the middle of a request.
-+ # See http://www.cherrypy.org/ticket/853
-+ if req and req.started_request and not req.sent_headers:
- req.simple_response("408 Request Timeout")
- elif errnum not in socket_errors_to_ignore:
- if req and not req.sent_headers: