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

[tor-commits] [snowflake/master] Use URLSearchParams.toString instead of Query.buildString.



commit e87ec6585801eb704ccabb783a56bc9a29ea2c7b
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Thu Jul 18 17:50:56 2019 -0600

    Use URLSearchParams.toString instead of Query.buildString.
---
 proxy/util.js      | 18 +-----------------
 proxy/websocket.js |  4 +---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/proxy/util.js b/proxy/util.js
index 0310899..dfc16f5 100644
--- a/proxy/util.js
+++ b/proxy/util.js
@@ -1,5 +1,5 @@
 /* global log */
-/* exported Query, Params, DummyRateLimit */
+/* exported Params, DummyRateLimit */
 
 /*
 A JavaScript WebRTC snowflake proxy
@@ -50,22 +50,6 @@ Util.TBB_UAS = [
 ];
 
 
-class Query {
-
-  // params is a list of (key, value) 2-tuples.
-  static buildString(params) {
-    var i, len, param, parts;
-    parts = [];
-    for (i = 0, len = params.length; i < len; i++) {
-      param = params[i];
-      parts.push(encodeURIComponent(param[0]) + '=' + encodeURIComponent(param[1]));
-    }
-    return parts.join('&');
-  }
-
-}
-
-
 class Parse {
 
   // Parse a cookie data string (usually document.cookie). The return type is an
diff --git a/proxy/websocket.js b/proxy/websocket.js
index 83911da..410fdc0 100644
--- a/proxy/websocket.js
+++ b/proxy/websocket.js
@@ -1,5 +1,3 @@
-/* global Query */
-
 /*
 Only websocket-specific stuff.
 */
@@ -36,7 +34,7 @@ class WS {
     }
     if (void 0 !== params) {
       parts.push('?');
-      parts.push(Query.buildString(params));
+      parts.push(new URLSearchParams(params).toString());
     }
     return parts.join('');
   }

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