[tor-commits] [flashproxy/master] Catch a recv error in handle_websocket_request.

dcf at torproject.org dcf at torproject.org
Mon Oct 1 03:23:25 UTC 2012


commit 6c6f60cec5f79da7dd72f47586fde07c68b83191
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Sep 30 20:18:41 2012 -0700

    Catch a recv error in handle_websocket_request.
---
 flashproxy-client |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/flashproxy-client b/flashproxy-client
index ded139e..64e01d9 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -491,7 +491,11 @@ class WebSocketRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 MAGIC_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
 
 def handle_websocket_request(fd):
-    request_text = fd.recv(10 * 1024)
+    try:
+        request_text = fd.recv(10 * 1024)
+    except socket.error, e:
+        log(u"Socket error while receiving WebSocket request: %s" % repr(str(e)))
+        return None
     handler = WebSocketRequestHandler(request_text, fd)
     if handler.error or not hasattr(handler, "path"):
         return None



More information about the tor-commits mailing list