Ignore StopIteration in HTTP parser.

We're specifically throwing the stop iteration to signal that a
connection was closed before data appeared (which is necessary for
the Keep-Alive processing). While a bit confusing for sync workers
as there's no Keep-Alive, it is an expected behavior.

Closes #65
This commit is contained in:
Paul J. Davis 2010-07-07 20:21:53 -04:00
parent 9631c2ab5a
commit e12e77765a
2 changed files with 4 additions and 2 deletions

View File

@ -45,7 +45,7 @@ class AsyncWorker(base.Worker):
if e[0] == errno.ECONNRESET:
self.log.warn("Ignoring connection reset")
else:
self.log.warn("Ignoring EPIPE")
self.log.debug("Ignoring EPIPE")
except Exception, e:
self.log.exception("General error processing request.")
try:

View File

@ -73,11 +73,13 @@ class SyncWorker(base.Worker):
parser = http.RequestParser(client)
req = parser.next()
self.handle_request(req, client, addr)
except StopIteration:
self.log.debug("Ignored premature client disconnection.")
except socket.error, e:
if e[0] != errno.EPIPE:
self.log.exception("Error processing request.")
else:
self.log.warn("Ignoring EPIPE")
self.log.debug("Ignoring EPIPE")
except Exception, e:
self.log.exception("Error processing request.")
try: