X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Flucid-http%2Fluasrc%2Flucid%2Fhttp%2Fserver.lua;h=95484a02f0bdd49c834aecfef45a90f81c010c4c;hp=f5de4e9a11831bcc9baea567c96ff250a5365387;hb=a75d30402813ad1eb5399f42c7d8996ee9b1e3dc;hpb=8c4f847ea5b95aaf0e716beaf736b4e2b67655ae diff --git a/libs/lucid-http/luasrc/lucid/http/server.lua b/libs/lucid-http/luasrc/lucid/http/server.lua index f5de4e9a1..95484a02f 100644 --- a/libs/lucid-http/luasrc/lucid/http/server.lua +++ b/libs/lucid-http/luasrc/lucid/http/server.lua @@ -344,7 +344,7 @@ function Server.parse_headers(self, source) end until false - env.SCRIPT_NAME, env.QUERY_STRING = env.REQUEST_URI:match("(.*)%??(.*)") + env.SCRIPT_NAME, env.QUERY_STRING = env.REQUEST_URI:match("([^?]*)%??(.*)") return req end @@ -358,8 +358,8 @@ function Server.process(self, client, env) local close = false local stat, code, msg, message, err - client:setsockopt("socket", "rcvtimeo", 15) - client:setsockopt("socket", "sndtimeo", 15) + client:setsockopt("socket", "rcvtimeo", 5) + client:setsockopt("socket", "sndtimeo", 5) repeat -- parse headers @@ -432,6 +432,8 @@ function Server.process(self, client, env) else return self:error(client, 411, statusmsg[411]) end + + close = true else return self:error(client, 405, statusmsg[405]) end @@ -453,14 +455,14 @@ function Server.process(self, client, env) end end if not headers["Content-Length"] then - if message.http_version == 1.1 then + if message.env.SERVER_PROTOCOL == "HTTP/1.1" then headers["Transfer-Encoding"] = "chunked" sinkout = chunksink(client) else close = true end end - elseif message.request_method ~= "head" then + elseif message.env.REQUEST_METHOD ~= "HEAD" then headers["Content-Length"] = 0 end