[enh] allow opening urls without protocol scheme

git-svn-id: file:///srv/svn/repo/yukari/trunk@120 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
asciimoo 2020-07-14 21:22:08 +00:00
parent d56146f07f
commit 53dfdf3070

View File

@ -294,6 +294,11 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) {
return return
} }
if parsedURI.Scheme == "" {
parsedURI.Scheme = "https"
requestURI = append([]byte("https://"), requestURI...)
}
// Serve an intermediate page for protocols other than HTTP(S) // Serve an intermediate page for protocols other than HTTP(S)
if (parsedURI.Scheme != "http" && parsedURI.Scheme != "https") || strings.HasSuffix(parsedURI.Host, ".onion") { if (parsedURI.Scheme != "http" && parsedURI.Scheme != "https") || strings.HasSuffix(parsedURI.Host, ".onion") {
p.serveExitMortyPage(ctx, parsedURI) p.serveExitMortyPage(ctx, parsedURI)