* libs/httpd: Added Cache-Control header to LuCI

* libs/httpd: Added Server-Header
This commit is contained in:
Steven Barth 2008-06-28 16:23:58 +00:00
parent cd4353e65f
commit 699784791c
2 changed files with 9 additions and 0 deletions

View file

@ -66,7 +66,12 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
headers[data1] = data2 headers[data1] = data2
end end
end end
<<<<<<< HEAD:libs/httpd/luasrc/httpd/handler/luci.lua
=======
>>>>>>> * libs/httpd: Added Cache-Control header to LuCI:libs/httpd/luasrc/httpd/handler/luci.lua
local function iter() local function iter()
local res, id, data = coroutine.resume(x) local res, id, data = coroutine.resume(x)
if not res then if not res then
@ -82,6 +87,7 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
headers["Expires"] = luci.http.protocol.date.to_http( os.time() ) headers["Expires"] = luci.http.protocol.date.to_http( os.time() )
headers["Date"] = headers["Expires"] headers["Date"] = headers["Expires"]
headers["Cache-Control"] = "no-cache"
return Response(status, headers), iter return Response(status, headers), iter
end end

View file

@ -20,6 +20,7 @@ require("socket.http")
require("luci.util") require("luci.util")
READ_BUFSIZE = 1024 READ_BUFSIZE = 1024
VERSION = 0.2
VHost = luci.util.class() VHost = luci.util.class()
@ -212,6 +213,8 @@ function Server.process( self, client )
tostring(response.status) .. " " .. tostring(response.status) .. " " ..
luci.http.protocol.statusmsg[response.status] .. "\r\n" luci.http.protocol.statusmsg[response.status] .. "\r\n"
header = header .. "Server: LuCI HTTPd/" .. tostring(VERSION) .. "\r\n"
for k,v in pairs(response.headers) do for k,v in pairs(response.headers) do
header = header .. k .. ": " .. v .. "\r\n" header = header .. k .. ": " .. v .. "\r\n"