Merge pull request #30 from dalf/html

[mod] static HTML

git-svn-id: file:///srv/svn/repo/yukari/trunk@32 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
asciimoo 2016-11-24 19:46:31 +00:00
parent 3ff4bfcfeb
commit 8716c2f731

View File

@ -491,6 +491,13 @@ func sanitizeMetaAttrs(rc *RequestConfig, out io.Writer, attrs [][][]byte) {
urlIndex := bytes.Index(bytes.ToLower(content), []byte("url="))
if bytes.Equal(http_equiv, []byte("refresh")) && urlIndex != -1 {
contentUrl := content[urlIndex+4:]
// special case of <meta http-equiv="refresh" content="0; url='example.com/url.with.quote.outside'">
if len(contentUrl)>=2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) {
if contentUrl[0] == contentUrl[len(contentUrl)-1] {
contentUrl=contentUrl[1:len(contentUrl)-1]
}
}
// output proxify result
if uri, err := rc.ProxifyURI(string(contentUrl)); err == nil {
fmt.Fprintf(out, ` http-equiv="refresh" content="%surl=%s"`, content[:urlIndex], uri)
}