mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
better logging on http parse errors
NoMoreData now inherits StopIteration and the StopIteration clause in the workers logs the reason at debug level.
This commit is contained in:
parent
c6f949b56b
commit
b955407003
@ -6,7 +6,7 @@
|
||||
class ParseException(Exception):
|
||||
pass
|
||||
|
||||
class NoMoreData(ParseException):
|
||||
class NoMoreData(ParseException, StopIteration):
|
||||
def __init__(self, buf=None):
|
||||
self.buf = buf
|
||||
def __str__(self):
|
||||
|
||||
@ -36,8 +36,8 @@ class AsyncWorker(base.Worker):
|
||||
if not req:
|
||||
break
|
||||
self.handle_request(req, client, addr)
|
||||
except StopIteration:
|
||||
pass
|
||||
except StopIteration, e:
|
||||
self.log.debug("Closing connection. %s", e)
|
||||
except socket.error, e:
|
||||
if e[0] not in (errno.EPIPE, errno.ECONNRESET):
|
||||
self.log.exception("Socket error processing request.")
|
||||
|
||||
@ -69,8 +69,8 @@ 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 StopIteration, e:
|
||||
self.log.debug("Closing connection. %s", e)
|
||||
except socket.error, e:
|
||||
if e[0] != errno.EPIPE:
|
||||
self.log.exception("Error processing request.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user