diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-05-05 10:59:37 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-05-05 10:59:37 +1200 |
commit | 1dc2fa0424cc1b87fce5ca12bcd3eba7e34725b7 (patch) | |
tree | c262f615baa4f60dfb9a9d05a3cd0f0df1894efc | |
parent | 589deb9fe14baa8e07d661d4e3d3a60c48512545 (diff) | |
download | mitmproxy-1dc2fa0424cc1b87fce5ca12bcd3eba7e34725b7.tar.gz mitmproxy-1dc2fa0424cc1b87fce5ca12bcd3eba7e34725b7.tar.bz2 mitmproxy-1dc2fa0424cc1b87fce5ca12bcd3eba7e34725b7.zip |
pathoc: cope with errors during websocket frame read.
-rw-r--r-- | libpathod/pathoc.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index 53ba4447..2574da6c 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -161,7 +161,11 @@ class WebsocketFrameReader(threading.Thread): pass for rfile in r: with self.log(rfile) as log: - frm = websockets.Frame.from_file(self.rfile) + try: + frm = websockets.Frame.from_file(self.rfile) + except tcp.NetLibError: + self.ws_read_limit = 0 + break log("<< %s"%frm.header.human_readable()) self.callback(frm) if self.ws_read_limit is not None: @@ -479,4 +483,3 @@ def main(args): # pragma: nocover pass if p: p.stop() - p.wait() |