Skip to content
Snippets Groups Projects
Commit 69dc5897 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Parse redirects the easy way.

I'm not sure what echicken was trying here, but apparently it doesn't
work for nelgin.

Likely fixes #220.
parent b9235ba4
No related branches found
No related tags found
No related merge requests found
......@@ -220,10 +220,7 @@ HTTPRequest.prototype.Get=function(url, referer, base) {
&& this.response_headers_parsed.Location.length
) {
this.follow_redirects--;
const re = /([a-z]+:\/\/.+:{0,1}\d{0,5})\//i;
var loc = this.response_headers_parsed.Location[0];
if (loc.search(re) < 0) loc = url.match(re)[1] + loc; // Assumes 'url' will match 're', but if it doesn't you'll have other problems anyway
return this.Get(loc, url); // To-do: be less tired and think about referer,base
return this.Get(this.response_headers_parsed.Location[0], this.url.url, this.url.url); // To-do: be less tired and think about referer,base
}
return(this.body);
};
......
  • echicken :chicken: @echicken ·
    Maintainer

    Yikes, I see where I was going with this, but I really fucked it up. If I'd taken the time to look at url.js I would've understood "base" and realized what to do. Thanks.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment