Skip to content
Snippets Groups Projects
Commit 02bc1bb8 authored by echicken's avatar echicken :chicken:
Browse files

Normalize parsed_headers keys to lowercase.

Fixes #675 (probably).
parent 274efc58
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -169,9 +169,10 @@ HTTPRequest.prototype.ReadHeaders=function() { ...@@ -169,9 +169,10 @@ HTTPRequest.prototype.ReadHeaders=function() {
this.contentlength=parseInt(m[1]); this.contentlength=parseInt(m[1]);
m = header.match(/^(.*?):\s*(.*?)\s*$/); m = header.match(/^(.*?):\s*(.*?)\s*$/);
if (m) { if (m) {
if (this.response_headers_parsed[m[1]] == undefined) var key = m[1].toLowerCase();
this.response_headers_parsed[m[1]] = []; if (this.response_headers_parsed[key] == undefined)
this.response_headers_parsed[m[1]].push(m[2]); this.response_headers_parsed[key] = [];
this.response_headers_parsed[key].push(m[2]);
} }
} }
}; };
...@@ -217,11 +218,11 @@ HTTPRequest.prototype.Get=function(url, referer, base) { ...@@ -217,11 +218,11 @@ HTTPRequest.prototype.Get=function(url, referer, base) {
this.ReadResponse(); this.ReadResponse();
if ([301, 302, 307, 308].indexOf(this.response_code) > -1 if ([301, 302, 307, 308].indexOf(this.response_code) > -1
&& this.follow_redirects > 0 && this.follow_redirects > 0
&& this.response_headers_parsed.Location && this.response_headers_parsed.location
&& this.response_headers_parsed.Location.length && this.response_headers_parsed.location.length
) { ) {
this.follow_redirects--; 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); return(this.body);
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment