[tor-commits] [flashproxy/master] Add make_websocket function.

dcf at torproject.org dcf at torproject.org
Mon Apr 9 04:08:42 UTC 2012


commit 111db68d84945b6b55c5f6bd4880860e80aeed4c
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Mar 29 20:49:28 2012 -0700

    Add make_websocket function.
    
    This builds a ws URL and attempts to work around the
    WebSocket/MozWebSocket naming.
---
 flashproxy.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/flashproxy.js b/flashproxy.js
index b69809d..1ea366f 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -99,6 +99,16 @@ function format_addr(addr)
     return addr.host + ":" + addr.port;
 }
 
+function make_websocket(addr)
+{
+    var url;
+
+    url = "ws://" + encodeURIComponent(addr.host)
+            + ":" + encodeURIComponent(addr.port) + "/";
+
+    return (window.WebSocket || window.MozWebSocket)(url, "base64");
+}
+
 function FlashProxy()
 {
     var debug_div = document.createElement("pre");





More information about the tor-commits mailing list