kineto: Fix relative redirects v1 PROPOSED

Adnan Maolood: 1
 Fix relative redirects

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/gmni-devel/patches/20517/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH kineto] Fix relative redirects Export this patch

Setting next.Host before setting next.Path breaks relative redirects on
external sites, where next.Host != r.URL.Host.
I sent this patch a while ago but it seems to have been forgotten on the
mailing list, so I am sending it again.

 main.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main.go b/main.go
index f13605e..bbfac30 100644
--- a/main.go
+++ b/main.go
@@ -426,10 +426,10 @@ func proxyGemini(req gemini.Request, external bool, root *url.URL,
			w.Write([]byte(fmt.Sprintf("This page is redirecting you to %s", next.String())))
		next.Host = r.URL.Host
		if external {
			next.Path = fmt.Sprintf("/x/%s/%s", next.Host, next.Path)
		next.Host = r.URL.Host
		next.Scheme = r.URL.Scheme
		w.Header().Add("Location", next.String())