[tor-commits] [snowflake/master] Only console.log the number of bytes, not the literal message.

dcf at torproject.org dcf at torproject.org
Thu Dec 20 04:44:49 UTC 2018


commit f06104d182454730c4a0916702b7ee83bce822b8
Author: David Fifield <david at bamsoftware.com>
Date:   Tue Dec 4 15:50:54 2018 -0700

    Only console.log the number of bytes, not the literal message.
    
    It doesn't really help to have a bunch TLS application records
    interpreted as a string written to the console.
---
 proxy/proxypair.coffee | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/proxy/proxypair.coffee b/proxy/proxypair.coffee
index e3a7f46..195f8fe 100644
--- a/proxy/proxypair.coffee
+++ b/proxy/proxypair.coffee
@@ -132,21 +132,15 @@ class ProxyPair
 
   # WebRTC --> websocket
   onClientToRelayMessage: (msg) =>
-    line = recv = msg.data
     if DEBUG
-      # Go sends only raw bytes...
-      if '[object ArrayBuffer]' == recv.toString()
-        bytes = new Uint8Array recv
-        line = String.fromCharCode.apply(null, bytes)
-      line = line.trim()
-      log 'WebRTC --> websocket data: ' + line
-    @c2rSchedule.push recv
+      log 'WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes'
+    @c2rSchedule.push msg.data
     @flush()
 
   # websocket --> WebRTC
   onRelayToClientMessage: (event) =>
     @r2cSchedule.push event.data
-    # log 'websocket-->WebRTC data: ' + event.data
+    # log 'websocket --> WebRTC data: ' + event.data.byteLength + ' bytes'
     @flush()
 
   onError: (event) =>





More information about the tor-commits mailing list