mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Use URLSearchParams.toString instead of Query.buildString.
This commit is contained in:
parent
fdc5563f87
commit
e87ec65858
2 changed files with 2 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* global log */
|
/* global log */
|
||||||
/* exported Query, Params, DummyRateLimit */
|
/* exported Params, DummyRateLimit */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A JavaScript WebRTC snowflake proxy
|
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 {
|
class Parse {
|
||||||
|
|
||||||
// Parse a cookie data string (usually document.cookie). The return type is an
|
// Parse a cookie data string (usually document.cookie). The return type is an
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/* global Query */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Only websocket-specific stuff.
|
Only websocket-specific stuff.
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +34,7 @@ class WS {
|
||||||
}
|
}
|
||||||
if (void 0 !== params) {
|
if (void 0 !== params) {
|
||||||
parts.push('?');
|
parts.push('?');
|
||||||
parts.push(Query.buildString(params));
|
parts.push(new URLSearchParams(params).toString());
|
||||||
}
|
}
|
||||||
return parts.join('');
|
return parts.join('');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue