[fix] avoid fasthttp panic on .onion urls - see https://github.com/valyala/fasthttp/issues/196

git-svn-id: file:///srv/svn/repo/yukari/trunk@18 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
asciimoo 2016-10-29 18:46:27 +00:00
parent dad05aa832
commit 1419bf2e85

View File

@ -147,6 +147,11 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) {
parsedURI, err := url.Parse(string(requestURI))
if strings.HasSuffix(parsedURI.Host, ".onion") {
p.serveMainPage(ctx, errors.New("Tor urls are not supported yet"))
return
}
if err != nil {
p.serveMainPage(ctx, err)
return