Updated variable scope in legacy HTTP.js file

This commit is contained in:
sevzero 2018-05-24 13:21:50 +00:00
parent 83c145c2ac
commit 67bd2605c0

View File

@ -45,18 +45,18 @@ const HTTP = {
* @returns {string}
*/
runDechunk: function(input, args) {
var chunks = [];
var chunkSizeEnd = input.indexOf("\n") + 1;
var lineEndings = input.charAt(chunkSizeEnd - 2) == "\r" ? "\r\n" : "\n";
var lineEndingsLength = lineEndings.length;
var chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16);
let chunks = [];
let chunkSizeEnd = input.indexOf("\n") + 1;
let lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n";
let lineEndingsLength = lineEndings.length;
let chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16);
while (!isNaN(chunkSize)) {
chunks.push(input.slice(chunkSizeEnd, chunkSize + chunkSizeEnd));
input = input.slice(chunkSizeEnd + chunkSize + lineEndingsLength);
chunkSizeEnd = input.indexOf(lineEndings) + lineEndingsLength;
chunkSize = parseInt(input.slice(0, chunkSizeEnd), 16);
}
return chunks.join('') + input;
return chunks.join("") + input;
},
/**