Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
- local function send(...)
- return uhttpd.send(...)
- end
-
- local function sendc(...)
- if env.HTTP_VERSION > 1.0 then
- return uhttpd.sendc(...)
- else
- return uhttpd.send(...)
- end
- end
+ local send = uhttpd.send
local req = luci.http.Request(
renv, recv, luci.ltn12.sink.file(io.stderr)
local req = luci.http.Request(
renv, recv, luci.ltn12.sink.file(io.stderr)
local hcache = { }
local active = true
local hcache = { }
local active = true
- if env.HTTP_VERSION > 1.0 then
- hcache["Transfer-Encoding"] = "chunked"
- end
-
while coroutine.status(x) ~= "dead" do
local res, id, data1, data2 = coroutine.resume(x, req)
if not res then
while coroutine.status(x) ~= "dead" do
local res, id, data1, data2 = coroutine.resume(x, req)
if not res then
- send(env.SERVER_PROTOCOL)
- send(" 500 Internal Server Error\r\n")
+ send("Status: 500 Internal Server Error\r\n")
send("Content-Type: text/plain\r\n\r\n")
send(tostring(id))
break
send("Content-Type: text/plain\r\n\r\n")
send(tostring(id))
break
if active then
if id == 1 then
if active then
if id == 1 then
- send(env.SERVER_PROTOCOL)
- send(" ")
send(tostring(data1))
send(" ")
send(tostring(data2))
send(tostring(data1))
send(" ")
send(tostring(data2))
end
send("\r\n")
elseif id == 4 then
end
send("\r\n")
elseif id == 4 then
- sendc(tostring(data1 or ""))
+ send(tostring(data1 or ""))
elseif id == 5 then
active = false
elseif id == 6 then
elseif id == 5 then
active = false
elseif id == 6 then