~sircmpwn/gmni-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH kineto] Fix relative redirects

Details
Message ID
<20210224225029.9789-1-me@adnano.co>
DKIM signature
pass
Download raw message
Patch: +1 -1
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())))
			return
		}
		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())
		w.WriteHeader(http.StatusFound)
-- 
2.30.1
Reply to thread Export thread (mbox)