HTTP server implementation for LuCI - helper class
(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
+(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.
require("luci.util")
READ_BUFSIZE = 1024
+VERSION = 0.2
VHost = luci.util.class()
end
-function Server.process( self, thread )
+function Server.process( self, client )
-- Setup sockets and sources
- local client = thread.socket
+ local thread = {
+ receive = function(self, ...) return luci.httpd.corecv(client, ...) end
+ }
+
client:settimeout( 0 )
+
local sourcein = ltn12.source.empty()
local sourcehdr = luci.http.protocol.header_source( thread )
local sinkerr = ltn12.sink.file( io.stderr )
tostring(response.status) .. " " ..
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
header = header .. k .. ": " .. v .. "\r\n"