From d421ff3730ff6d0440f196e23e676da2354d32d5 Mon Sep 17 00:00:00 2001 From: echicken <echicken@bbs.electronicchicken.com> Date: Fri, 24 Nov 2023 14:14:43 +0000 Subject: [PATCH] Normalize parsed_headers keys to lowercase. Fixes #675 (probably). --- exec/load/http.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/exec/load/http.js b/exec/load/http.js index c9de9aa619..a3de7f4e69 100644 --- a/exec/load/http.js +++ b/exec/load/http.js @@ -169,9 +169,10 @@ HTTPRequest.prototype.ReadHeaders=function() { this.contentlength=parseInt(m[1]); m = header.match(/^(.*?):\s*(.*?)\s*$/); if (m) { - if (this.response_headers_parsed[m[1]] == undefined) - this.response_headers_parsed[m[1]] = []; - this.response_headers_parsed[m[1]].push(m[2]); + var key = m[1].toLowerCase(); + if (this.response_headers_parsed[key] == undefined) + this.response_headers_parsed[key] = []; + this.response_headers_parsed[key].push(m[2]); } } }; @@ -217,11 +218,11 @@ HTTPRequest.prototype.Get=function(url, referer, base) { this.ReadResponse(); if ([301, 302, 307, 308].indexOf(this.response_code) > -1 && this.follow_redirects > 0 - && this.response_headers_parsed.Location - && this.response_headers_parsed.Location.length + && this.response_headers_parsed.location + && this.response_headers_parsed.location.length ) { this.follow_redirects--; - return this.Get(this.response_headers_parsed.Location[0], this.url.url, this.url.url); + return this.Get(this.response_headers_parsed.location[0], this.url.url, this.url.url); } return(this.body); }; -- GitLab