X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fhttp.lua;h=c5a85ea4d9f777187855549adabf0c18e199f32a;hp=6b73b9414cf0c129a1596ac4144b64d12fc529da;hb=9d85bd73e5562ae72715935187ce0d55c3009d24;hpb=ffd5c4ec656bd3f216c66b43587abcfdaf2b5c37 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