[fix] use html content-type on xhtml responses - closes #17

git-svn-id: file:///srv/svn/repo/yukari/trunk@50 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
asciimoo 2016-11-29 10:12:48 +00:00
parent a08215f684
commit 5f79df00a5

View File

@ -124,7 +124,7 @@ var LINK_HTTP_EQUIV_SAFE_VALUES [][]byte = [][]byte{
// X-UA-Compatible will be added automaticaly, so it can be skipped
[]byte("date"),
[]byte("last-modified"),
[]byte("refresh"), // URL rewrite
[]byte("refresh"), // URL rewrite
// []byte("location"), TODO URL rewrite
[]byte("content-language"),
}
@ -284,7 +284,11 @@ func (p *Proxy) RequestHandler(ctx *fasthttp.RequestCtx) {
responseBody = resp.Body()
}
ctx.SetContentType(fmt.Sprintf("%s; charset=UTF-8", contentInfo[0]))
if bytes.Contains(contentType, []byte("xhtml")) {
ctx.SetContentType("text/html; charset=UTF-8")
} else {
ctx.SetContentType(fmt.Sprintf("%s; charset=UTF-8", contentInfo[0]))
}
switch {
case bytes.Contains(contentType, []byte("css")):