diff --git a/lib/internal/querystring.js b/lib/internal/querystring.js index ee589e1984294d..ba4cc98f84a54d 100644 --- a/lib/internal/querystring.js +++ b/lib/internal/querystring.js @@ -17,16 +17,7 @@ const isHexTable = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 64 - 79 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80 - 95 - 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 96 - 111 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 112 - 127 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 128 ... - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // ... 256 + 0, 1, 1, 1, 1, 1, 1 // 96 - 102 ]; function encodeStr(str, noEscapeTable, hexTable) { diff --git a/lib/internal/url.js b/lib/internal/url.js index 7c2637246e9b51..09785429dc72d2 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -781,7 +781,7 @@ function parseParams(qs) { if (code === CHAR_PERCENT) { encodeCheck = 1; } else if (encodeCheck > 0) { - if (isHexTable[code] === 1) { + if (isHexTable[code]) { if (++encodeCheck === 3) { querystring = require('querystring'); encoded = true; diff --git a/lib/querystring.js b/lib/querystring.js index f057226f08b51f..0e460138c2630d 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -59,16 +59,7 @@ const unhexTable = [ +0, +1, +2, +3, +4, +5, +6, +7, +8, +9, -1, -1, -1, -1, -1, -1, // 48 - 63 -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 64 - 79 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 80 - 95 - -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 96 - 111 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 112 - 127 - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 128 ... - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // ... 255 + -1, 10, 11, 12, 13, 14, 15 // 96 - 102 ]; // A safe fast alternative to decodeURIComponent function unescapeBuffer(s, decodeSpaces) { @@ -354,7 +345,7 @@ function parse(qs, sep, eq, options) { encodeCheck = 1; continue; } else if (encodeCheck > 0) { - if (isHexTable[code] === 1) { + if (isHexTable[code]) { if (++encodeCheck === 3) keyEncoded = true; continue; @@ -383,7 +374,7 @@ function parse(qs, sep, eq, options) { if (code === 37/* % */) { encodeCheck = 1; } else if (encodeCheck > 0) { - if (isHexTable[code] === 1) { + if (isHexTable[code]) { if (++encodeCheck === 3) valEncoded = true; } else {