From e2f3191212c45ce23472aefe2678c9858c9ea32d Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 20 Apr 2024 09:58:06 +0100 Subject: [PATCH] Split out debug heading into 2 headers, one each for request/response 0 = no zlib compression 1 = use zlib compression --- project/src/servers/http/AkiHttpListener.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/project/src/servers/http/AkiHttpListener.ts b/project/src/servers/http/AkiHttpListener.ts index 34913e49..315f5a22 100644 --- a/project/src/servers/http/AkiHttpListener.ts +++ b/project/src/servers/http/AkiHttpListener.ts @@ -64,10 +64,11 @@ export class AkiHttpListener implements IHttpListener // determine if the payload is compressed. All PUT requests are, and POST requests without // debug = 1 are as well. This should be fixed. // let compressed = req.headers["content-encoding"] === "deflate"; - const compressed = req.method === "PUT" || req.headers.debug !== "1"; + const requestIsCompressed = req.headers.requestcompressed === "1"; + const requestCompressed = req.method === "PUT" || requestIsCompressed; - const value = compressed ? zlib.inflateSync(buffer) : buffer; - if (req.headers.debug === "1") + const value = requestCompressed ? zlib.inflateSync(buffer) : buffer; + if (!requestIsCompressed) { this.logger.debug(value.toString(), true); } @@ -107,7 +108,7 @@ export class AkiHttpListener implements IHttpListener let handled = false; // Check if this is a debug request, if so just send the raw response without transformation - if (req.headers.debug === "1") + if (req.headers.responsecompressed === "0") { this.sendJson(resp, output, sessionID); }