From 871f07ad2e02040e10f85c7c77dca465932582ab Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 12 Sep 2008 16:12:51 +0000 Subject: Avoid XML errors --- libs/web/luasrc/http.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libs/web/luasrc/http.lua') diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua index 6b73b9414..c5a85ea4d 100644 --- a/libs/web/luasrc/http.lua +++ b/libs/web/luasrc/http.lua @@ -192,14 +192,16 @@ end --- Set the mime type of following content data. -- @param mime Mimetype of following content function prepare_content(mime) - if mime == "application/xhtml+xml" then - if not getenv("HTTP_ACCEPT") or - not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then - mime = "text/html; charset=UTF-8" + if not context.headers or not context.headers["content-type"] then + if mime == "application/xhtml+xml" then + if not getenv("HTTP_ACCEPT") or + not getenv("HTTP_ACCEPT"):find("application/xhtml+xml", nil, true) then + mime = "text/html; charset=UTF-8" + end + header("Vary", "Accept") end - header("Vary", "Accept") + header("Content-Type", mime) end - header("Content-Type", mime) end --- Get the RAW HTTP input source -- cgit v1.2.3