projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
54e2e5a
)
* luci/httpd: Populated missing functions to wrapped socket
author
Steven Barth
<steven@midlink.org>
Sun, 29 Jun 2008 20:49:06 +0000
(20:49 +0000)
committer
Steven Barth
<steven@midlink.org>
Sun, 29 Jun 2008 20:49:06 +0000
(20:49 +0000)
libs/httpd/luasrc/httpd/server.lua
patch
|
blob
|
history
diff --git
a/libs/httpd/luasrc/httpd/server.lua
b/libs/httpd/luasrc/httpd/server.lua
index
9ec8961
..
6cbffa1
100644
(file)
--- a/
libs/httpd/luasrc/httpd/server.lua
+++ b/
libs/httpd/luasrc/httpd/server.lua
@@
-112,7
+112,10
@@
function Server.process( self, client )
-- Setup sockets and sources
local thread = {
receive = function(self, ...) return luci.httpd.corecv(client, ...) end,
-- Setup sockets and sources
local thread = {
receive = function(self, ...) return luci.httpd.corecv(client, ...) end,
- send = function(self, ...) return luci.httpd.cosend(client, ...) end
+ send = function(self, ...) return luci.httpd.cosend(client, ...) end,
+ close = function(self, ...) return client:close(...) end,
+ getfd = function(self, ...) return client:getfd(...) end,
+ dirty = function(self, ...) return client:dirty(...) end
}
client:settimeout( 0 )
}
client:settimeout( 0 )
@@
-132,7
+135,7
@@
function Server.process( self, client )
message, err = luci.http.protocol.parse_message_header( sourcehdr )
if not message then
message, err = luci.http.protocol.parse_message_header( sourcehdr )
if not message then
- self:error(
client
, 400, err )
+ self:error(
thread
, 400, err )
break
end
break
end
@@
-152,7
+155,7
@@
function Server.process( self, client )
if message.http_version == 1.1 and message.headers['Expect'] and
message.headers['Expect'] == '100-continue'
then
if message.http_version == 1.1 and message.headers['Expect'] and
message.headers['Expect'] == '100-continue'
then
-
client
:send("HTTP/1.1 100 Continue\r\n\r\n")
+
thread
:send("HTTP/1.1 100 Continue\r\n\r\n")
end
if message.headers['Transfer-Encoding'] and
end
if message.headers['Transfer-Encoding'] and
@@
-162,12
+165,12
@@
function Server.process( self, client )
sourcein = socket.source("by-length", thread,
tonumber(message.env.CONTENT_LENGTH))
else
sourcein = socket.source("by-length", thread,
tonumber(message.env.CONTENT_LENGTH))
else
- self:error(
client
, 411, luci.http.protocol.statusmsg[411] )
+ self:error(
thread
, 411, luci.http.protocol.statusmsg[411] )
break;
end
else
break;
end
else
- self:error(
client
, 405, luci.http.protocol.statusmsg[405] )
+ self:error(
thread
, 405, luci.http.protocol.statusmsg[405] )
break;
end
break;
end
@@
-175,7
+178,7
@@
function Server.process( self, client )
local host = self.vhosts[message.env.HTTP_HOST] or self.host
if not host then
local host = self.vhosts[message.env.HTTP_HOST] or self.host
if not host then
- self:error(
client
, 500, "Unable to find matching host" )
+ self:error(
thread
, 500, "Unable to find matching host" )
break;
end
break;
end
@@
-184,7
+187,7
@@
function Server.process( self, client )
client, io.stderr
)
if not response then
client, io.stderr
)
if not response then
- self:error(
client
, 500, "Error processing handler" )
+ self:error(
thread
, 500, "Error processing handler" )
end
-- Post process response
end
-- Post process response
@@
-221,8
+224,8
@@
function Server.process( self, client )
header = header .. k .. ": " .. v .. "\r\n"
end
header = header .. k .. ": " .. v .. "\r\n"
end
-
client
:send(header .. "\r\n")
-
+
thread
:send(header .. "\r\n")
+
if sourceout then
local eof = false
repeat
if sourceout then
local eof = false
repeat