From 06073423030b412660c1e69699567b40bbab5a78 Mon Sep 17 00:00:00 2001 From: Macide Celik Date: Tue, 29 Oct 2019 00:13:33 +0300 Subject: [PATCH] Delete DechunkHTTPResponse.mjs --- src/core/operations/DechunkHTTPResponse.mjs | 51 --------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/core/operations/DechunkHTTPResponse.mjs diff --git a/src/core/operations/DechunkHTTPResponse.mjs b/src/core/operations/DechunkHTTPResponse.mjs deleted file mode 100644 index 6a4c3813..00000000 --- a/src/core/operations/DechunkHTTPResponse.mjs +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @author sevzero [sevzero@protonmail.com] - * @copyright Crown Copyright 2018 - * @license Apache-2.0 - */ - -import Operation from "../Operation.mjs"; - -/** - * Dechunk HTTP response operation - */ -class DechunkHTTPResponse extends Operation { - - /** - * DechunkHTTPResponse constructor - */ - constructor() { - super(); - - this.name = "Dechunk HTTP response"; - this.module = "Default"; - this.description = "Parses an HTTP response transferred using Transfer-Encoding: Chunked"; - this.infoURL = "https://wikipedia.org/wiki/Chunked_transfer_encoding"; - this.inputType = "string"; - this.outputType = "string"; - this.args = []; - } - - /** - * @param {string} input - * @param {Object[]} args - * @returns {string} - */ - run(input, args) { - const chunks = []; - let chunkSizeEnd = input.indexOf("\n") + 1; - const lineEndings = input.charAt(chunkSizeEnd - 2) === "\r" ? "\r\n" : "\n"; - const 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; - } - -} - -export default DechunkHTTPResponse;