Commit d466ebdb authored by Sam Rushing's avatar Sam Rushing

connection.run(): send error reply *after* log line so connection problems don't interfere

http_request.__repr__(): a more useful repr
parent 936dd937
...@@ -91,10 +91,11 @@ class connection: ...@@ -91,10 +91,11 @@ class connection:
except HTTP_Upgrade: except HTTP_Upgrade:
upgrade = True upgrade = True
break break
# XXX use Exception here, avoid catch/raise of coro.TimeoutError/Interrupted?
except: except:
tb = coro.compact_traceback() tb = coro.compact_traceback()
request.error (500, tb)
self.server.log ('error: %r request=%r tb=%r' % (self.peer, request, tb)) self.server.log ('error: %r request=%r tb=%r' % (self.peer, request, tb))
request.error (500, tb)
except (OSError, coro.TimeoutError, coro.ClosedError): except (OSError, coro.TimeoutError, coro.ClosedError):
pass pass
finally: finally:
...@@ -160,6 +161,9 @@ class http_request: ...@@ -160,6 +161,9 @@ class http_request:
if self.has_body(): if self.has_body():
self.file = http_file (headers, client.stream) self.file = http_file (headers, client.stream)
def __repr__ (self):
return '<http request from %r : %r>' % (self.peer, self.request,)
def wait_until_read (self): def wait_until_read (self):
"wait until this entire request body has been read" "wait until this entire request body has been read"
if self.file: if self.file:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment