[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 111db68d84945b6b55c5f6bd4880860e80aeed4c
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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");



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits