+ self.started_request = False
self.started_response = False
# (although your TCP stack might suffer for it: cf Apache's history
request_line = self.rfile.readline()
+ # Set started_request to True so communicate() knows to send 408
+ self.started_request = True
# Force self.ready = False so the connection will close.
# This order of operations should guarantee correct pipelining.
+ # Something went wrong in the parsing (and the server has
+ # probably already made a simple_response). Return and
- if req.ready and errnum == 'timed out':
- if req and not req.sent_headers:
+ if errnum == 'timed out':
+ # Don't send a 408 if there is no outstanding 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: