From 53dfdf3070483957e3a7a76149345128374552f1 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Tue, 14 Jul 2020 21:22:08 +0000 Subject: [PATCH] [enh] allow opening urls without protocol scheme git-svn-id: file:///srv/svn/repo/yukari/trunk@120 f3bd38d9-da89-464d-a02a-eb04e43141b5 --- morty.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/morty.go b/morty.go index 945e0ec..6def9a7 100644 --- a/morty.go +++ b/morty.go @@ -294,6 +294,11 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) { return } + if parsedURI.Scheme == "" { + parsedURI.Scheme = "https" + requestURI = append([]byte("https://"), requestURI...) + } + // Serve an intermediate page for protocols other than HTTP(S) if (parsedURI.Scheme != "http" && parsedURI.Scheme != "https") || strings.HasSuffix(parsedURI.Host, ".onion") { p.serveExitMortyPage(ctx, parsedURI)