[tor-commits] [flashproxy/master] Add a websockify patch to assume binary frames in the absence of "base64".

dcf at torproject.org dcf at torproject.org
Thu Apr 19 22:16:07 UTC 2012


commit 4ca2f2e70974fff095f01964d80ef271c1d55543
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Apr 19 14:31:14 2012 -0700

    Add a websockify patch to assume binary frames in the absence of "base64".
    
    Otherwise websockify just terminates the connection unless the
    subprotocol is "base64" or "binary".
---
 README                                  |    2 ++
 patches/websockify-binary-default.patch |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/README b/README
index e9917e4..5aa054f 100644
--- a/README
+++ b/README
@@ -118,6 +118,7 @@ re-register:
 
 The relay runs with a WebSocket proxy in external proxy mode.
 	git clone git://github.com/kanaka/websockify.git
+	git apply ~/flashproxy/patches/websockify-binary-default.patch
 This command proxies WebSocket on port 9901 to a local ORPort on 9001.
 	./websockify :9901 127.0.0.1:9001
 The init.d script described under "Installing so as to restart at boot"
@@ -160,6 +161,7 @@ CentOS. "make install" copies files to /usr/local/bin.
 	# service facilitator start
 
 	# cd websockify
+	# git apply ~/flashproxy/patches/websockify-binary-default.patch
 	# cp websockify websocket.py /usr/local/bin
 	# useradd -d /dev/null -s /bin/false websockify
 	# mkdir /var/websockify
diff --git a/patches/websockify-binary-default.patch b/patches/websockify-binary-default.patch
new file mode 100644
index 0000000..9ba7f06
--- /dev/null
+++ b/patches/websockify-binary-default.patch
@@ -0,0 +1,26 @@
+From 066c665c2e437a399e2fd0b55394b0ec82c7aeab Mon Sep 17 00:00:00 2001
+From: David Fifield <david at bamsoftware.com>
+Date: Thu, 19 Apr 2012 14:16:16 -0700
+Subject: [PATCH] Assume binary transfer when no subprotocol is given.
+
+---
+ websocket.py |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/websocket.py b/websocket.py
+index 646160c..d6cea57 100644
+--- a/websocket.py
++++ b/websocket.py
+@@ -660,7 +660,8 @@ Sec-WebSocket-Accept: %s\r
+             elif 'base64' in protocols:
+                 self.base64 = True
+             else:
+-                raise self.EClose("Client must support 'binary' or 'base64' protocol")
++                self.base64 = False
++                # raise self.EClose("Client must support 'binary' or 'base64' protocol")
+ 
+             # Generate the hash value for the accept header
+             accept = b64encode(sha1(s2b(key + self.GUID)).digest())
+-- 
+1.7.9.5
+





More information about the tor-commits mailing list