Merge pull request #36 from dalf/head
svg, math, link and meta tags git-svn-id: file:///srv/svn/repo/yukari/trunk@47 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
parent
cd487310a3
commit
6202e9d41c
16
morty.go
16
morty.go
@ -202,18 +202,11 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) {
|
||||
defer fasthttp.ReleaseRequest(req)
|
||||
req.SetConnectionClose()
|
||||
|
||||
reqQuery := parsedURI.Query()
|
||||
ctx.QueryArgs().VisitAll(func(key, value []byte) {
|
||||
reqQuery.Add(string(key), string(value))
|
||||
})
|
||||
requestURIStr := string(requestURI)
|
||||
|
||||
parsedURI.RawQuery = reqQuery.Encode()
|
||||
log.Println("getting", requestURIStr)
|
||||
|
||||
uriStr := parsedURI.String()
|
||||
|
||||
log.Println("getting", uriStr)
|
||||
|
||||
req.SetRequestURI(uriStr)
|
||||
req.SetRequestURI(requestURIStr)
|
||||
req.Header.SetUserAgentBytes([]byte("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"))
|
||||
|
||||
resp := fasthttp.AcquireResponse()
|
||||
@ -252,7 +245,7 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
error_message := fmt.Sprintf("invalid response: %d", resp.StatusCode())
|
||||
error_message := fmt.Sprintf("invalid response: %d (%s)", resp.StatusCode(), requestURIStr)
|
||||
p.serveMainPage(ctx, resp.StatusCode(), errors.New(error_message))
|
||||
return
|
||||
}
|
||||
@ -651,6 +644,7 @@ func (rc *RequestConfig) ProxifyURI(uri string) (string, error) {
|
||||
if rc.Key == nil {
|
||||
return fmt.Sprintf("./?mortyurl=%s", url.QueryEscape(uri)), nil
|
||||
}
|
||||
|
||||
return fmt.Sprintf("./?mortyhash=%s&mortyurl=%s", hash(uri, rc.Key), url.QueryEscape(uri)), nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user