X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Flucid-http%2Fluasrc%2Flucid%2Fhttp%2Fserver.lua;h=bc8d53168c95be125764e365b3dc77882352b2e9;hb=92bbfc8ca837a6c447fc8402789123cfa81c92ed;hp=0fe947316635251c6f207c6c793514bd92324335;hpb=b8ab3b9dacab9c6d4344c60fdb4046087a24f233;p=project%2Fluci.git diff --git a/libs/lucid-http/luasrc/lucid/http/server.lua b/libs/lucid-http/luasrc/lucid/http/server.lua index 0fe947316..bc8d53168 100644 --- a/libs/lucid-http/luasrc/lucid/http/server.lua +++ b/libs/lucid-http/luasrc/lucid/http/server.lua @@ -132,6 +132,7 @@ function Handler.checkrestricted(self, request) end if stat then + request.env.HTTP_AUTH_USER, request.env.HTTP_AUTH_PASS = user, pass return end end @@ -197,6 +198,10 @@ function VHost.process(self, request, ...) -- Call URI part request.env.PATH_INFO = uri + if self.default and uri == "/" then + return 302, {Location = self.default} + end + for k, h in pairs(self.handlers) do if #k > hlen then if uri == k or (uri:sub(1, #k) == k and uri:byte(#k+1) == sc) then @@ -524,9 +529,10 @@ function Server.process(self, client, env) if close then headers["Connection"] = "close" - elseif message.env.SERVER_PROTOCOL == "HTTP/1.0" then + else headers["Connection"] = "Keep-Alive" - end + headers["Keep-Alive"] = "timeout=5, max=50" + end headers["Date"] = date.to_http(os.time()) local header = {