libs/web: Corrected HTTP-Headers
[project/luci.git] / libs / web / luasrc / http.lua
index 4fa6438653d8154d5ab59ac92b7a0a50aa7a2e91..5b922d99438b14863b87b8b8901c8f6fc7e97cbe 100644 (file)
@@ -172,6 +172,13 @@ 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"
+               end
+               header("Vary", "Accept")
+       end
        header("Content-Type", mime)
 end