[fix] fix infinite loop with <base target=".." />

git-svn-id: file:///srv/svn/repo/yukari/trunk@40 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
alex 2016-11-26 10:16:11 +00:00
parent ba5cc3a702
commit 7e303f3fe9

View File

@ -353,12 +353,11 @@ func sanitizeHTML(rc *RequestConfig, out io.Writer, htmlDoc []byte) {
if bytes.Equal(tag, []byte("base")) {
for {
attrName, attrValue, moreAttr := decoder.TagAttr()
if !bytes.Equal(attrName, []byte("href")) {
continue
}
parsedURI, err := url.Parse(string(attrValue))
if err == nil {
rc.BaseURL = parsedURI
if bytes.Equal(attrName, []byte("href")) {
parsedURI, err := url.Parse(string(attrValue))
if err == nil {
rc.BaseURL = parsedURI
}
}
if !moreAttr {
break