mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 14:11:02 +01:00
Reduced variable scopes
This commit is contained in:
parent
53bf52c989
commit
83c145c2ac
@ -31,18 +31,18 @@ class DechunkHTTP extends Operation {
|
||||
* @returns {string}
|
||||
*/
|
||||
run(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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user