projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* libs/http: fix header handling in conditionals.lua
[project/luci.git]
/
libs
/
httpd
/
luasrc
/
httpd
/
handler
/
luci.lua
diff --git
a/libs/httpd/luasrc/httpd/handler/luci.lua
b/libs/httpd/luasrc/httpd/handler/luci.lua
index
49a9abc
..
4a83de1
100644
(file)
--- a/
libs/httpd/luasrc/httpd/handler/luci.lua
+++ b/
libs/httpd/luasrc/httpd/handler/luci.lua
@@
-1,7
+1,7
@@
--[[
HTTP server implementation for LuCI - luci handler
--[[
HTTP server implementation for LuCI - luci handler
-(c) 2008 Steven Barth <steven@midlink.org>
+(c) 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@
-17,6
+17,7
@@
module("luci.httpd.handler.luci", package.seeall)
require("luci.dispatcher")
require("luci.http")
require("luci.dispatcher")
require("luci.http")
+require("luci.http.protocol.date")
require("ltn12")
Luci = luci.util.class(luci.httpd.module.Handler)
require("ltn12")
Luci = luci.util.class(luci.httpd.module.Handler)
@@
-35,37
+36,37
@@
function Luci.handle_post(self, ...)
return self:handle_get(...)
end
return self:handle_get(...)
end
-function Luci.handle_get(self, request, sourcein, sinkerr)
+function Luci.handle_get(self, request, sourcein, sinkerr)
local r = luci.http.Request(
request.env,
sourcein,
sinkerr
)
local r = luci.http.Request(
request.env,
sourcein,
sinkerr
)
-
+
local res, id, data1, data2 = true, 0, nil, nil
local headers = {}
local status = 200
local res, id, data1, data2 = true, 0, nil, nil
local headers = {}
local status = 200
-
+
local x = coroutine.create(luci.dispatcher.httpdispatch)
while not id or id < 3 do
coroutine.yield()
local x = coroutine.create(luci.dispatcher.httpdispatch)
while not id or id < 3 do
coroutine.yield()
-
+
res, id, data1, data2 = coroutine.resume(x, r)
res, id, data1, data2 = coroutine.resume(x, r)
-
+
if not res then
status = 500
headers["Content-Type"] = "text/plain"
local err = {id}
return Response( status, headers ), function() return table.remove(err) end
end
if not res then
status = 500
headers["Content-Type"] = "text/plain"
local err = {id}
return Response( status, headers ), function() return table.remove(err) end
end
-
+
if id == 1 then
status = data1
elseif id == 2 then
headers[data1] = data2
end
end
if id == 1 then
status = data1
elseif id == 2 then
headers[data1] = data2
end
end
-
+
local function iter()
local res, id, data = coroutine.resume(x)
if not res then
local function iter()
local res, id, data = coroutine.resume(x)
if not res then
@@
-78,6
+79,9
@@
function Luci.handle_get(self, request, sourcein, sinkerr)
return data
end
end
return data
end
end
-
+
+ headers["Expires"] = luci.http.protocol.date.to_http( os.time() )
+ headers["Date"] = headers["Expires"]
+
return Response(status, headers), iter
end
return Response(status, headers), iter
end