[fix] parse hostnames even if scheme is missing

git-svn-id: file:///srv/svn/repo/yukari/trunk@128 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
asciimoo 2020-07-14 21:24:04 +00:00
parent 756d8c977a
commit 640db34ff5

View File

@ -321,8 +321,12 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) {
} }
if parsedURI.Scheme == "" { if parsedURI.Scheme == "" {
parsedURI.Scheme = "https"
requestURI = append([]byte("https://"), requestURI...) requestURI = append([]byte("https://"), requestURI...)
parsedURI, err = url.Parse(string(requestURI))
if err != nil {
p.serveMainPage(ctx, 500, err)
return
}
} }
// Serve an intermediate page for protocols other than HTTP(S) // Serve an intermediate page for protocols other than HTTP(S)