commit 9da7c9a065ebb74027d0618327a786227ef3d245 Author: David Fifield david@bamsoftware.com Date: Sat Apr 7 11:55:12 2012 -0600
Gracefully handle a masking error from a remote. --- connector.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/connector.py b/connector.py index d10a6ab..a0b7149 100755 --- a/connector.py +++ b/connector.py @@ -620,7 +620,13 @@ def proxy_chunk_remote_to_local(remote, local, data = None): else: remote.dec.feed(data) while True: - data = remote.dec.read() + try: + data = remote.dec.read() + except (WebSocketDecoder.MaskingError, ValueError), e: + log(u"WebSocket decode error from remote: %s" % repr(str(e))) + remote.close() + local.close() + return False if data is None: break elif not data:
tor-commits@lists.torproject.org