From ae6c104e48aaa7c908444c915801f70fe87c1390 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Mon, 15 Feb 2021 18:48:05 -0500
Subject: [PATCH] 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.
---
 exec/load/http.js | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/exec/load/http.js b/exec/load/http.js
index 071ca35a42..58ed80bd1a 100644
--- a/exec/load/http.js
+++ b/exec/load/http.js
@@ -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);
 };
-- 
GitLab