From 5f79df00a5f8e00916d7bc27c7809ad7e9b96a91 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Tue, 29 Nov 2016 10:12:48 +0000 Subject: [PATCH] [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 --- morty.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/morty.go b/morty.go index f8eb228..8d68dbb 100644 --- a/morty.go +++ b/morty.go @@ -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")):