X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fhttpd%2Fluasrc%2Fhttpd%2Fserver.lua;h=7bfac68629bbe0ac7a4e69c695ad68bed6d9b6bd;hp=57221647fceba2893a98e255a601a00f4c0f81d3;hb=699784791cfc05cc03ebce731dca5e5c29b0ab87;hpb=741bbe7817d94a02270e3bf425b6e0ff77c5015d diff --git a/libs/httpd/luasrc/httpd/server.lua b/libs/httpd/luasrc/httpd/server.lua index 57221647fc..7bfac68629 100644 --- a/libs/httpd/luasrc/httpd/server.lua +++ b/libs/httpd/luasrc/httpd/server.lua @@ -2,6 +2,7 @@ HTTP server implementation for LuCI - helper class (c) 2008 Freifunk Leipzig / Jo-Philipp Wich +(c) 2008 Steven Barth Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +20,7 @@ require("socket.http") require("luci.util") READ_BUFSIZE = 1024 +VERSION = 0.2 VHost = luci.util.class() @@ -105,11 +107,15 @@ function Server.error_overload(self, socket) 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 ) @@ -207,6 +213,8 @@ function Server.process( self, thread ) 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"