From 660a2e0ed6f9393f06bc3df6bd2425661d33ec8d Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Sat, 16 Jul 2022 19:51:35 +0100 Subject: [PATCH] Allow HTTP Headers not in spec potential fix for #3772 --- .../@node-red/nodes/core/network/21-httprequest.html | 12 ++++++++++++ .../@node-red/nodes/core/network/21-httprequest.js | 4 ++++ .../@node-red/nodes/locales/en-US/messages.json | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.html b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.html index 8b1320496..b9a44e1b4 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.html +++ b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.html @@ -91,6 +91,11 @@ +
+ + +
+
@@ -227,6 +232,7 @@ persist: {value:false}, proxy: {type:"http proxy",required: false, label:RED._("node-red:httpin.proxy-config") }, + insecureHTTPParser: {value: false}, authType: {value: ""}, senderr: {value: false}, headers: { value: [] } @@ -338,6 +344,12 @@ } else { $("#node-input-useProxy").prop("checked", false); } + + if (node.insecureHTTPParser) { + $("node-intput-insecureHTTPParser").prop("checked", true) + } else { + $("node-intput-insecureHTTPParser").prop("checked", false) + } updateProxyOptions(); $("#node-input-useProxy").on("click", function() { updateProxyOptions(); diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js index 6a19d2ed2..b94d59dc7 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js +++ b/packages/node_modules/@node-red/nodes/core/network/21-httprequest.js @@ -244,6 +244,10 @@ in your Node-RED user directory (${RED.settings.userDir}). delete options.headers[h]; } }) + + if (node.insecureHTTPParser) { + options.insecureHTTPParser = true + } } ], beforeRedirect: [ diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json index 62d5f351f..b38ab3026 100644 --- a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json @@ -554,7 +554,8 @@ }, "status": { "requesting": "requesting" - } + }, + "insecureHTTPParser": "Lenient HTTP Header Parsing" }, "websocket": { "label": {