Merge pull request #62 from bhollosi/dev
typo fix at Cache-Control header, new http response code: 500
This commit is contained in:
commit
c2aeffc130
@ -5,7 +5,7 @@
|
|||||||
return function(connection, code, extension, isGzipped)
|
return function(connection, code, extension, isGzipped)
|
||||||
|
|
||||||
local function getHTTPStatusString(code)
|
local function getHTTPStatusString(code)
|
||||||
local codez = {[200]="OK", [400]="Bad Request", [404]="Not Found",}
|
local codez = { [200] = "OK", [400] = "Bad Request", [404] = "Not Found", [500] = "Internal Server Error", }
|
||||||
local myResult = codez[code]
|
local myResult = codez[code]
|
||||||
-- enforce returning valid http codes all the way throughout?
|
-- enforce returning valid http codes all the way throughout?
|
||||||
if myResult then return myResult else return "Not Implemented" end
|
if myResult then return myResult else return "Not Implemented" end
|
||||||
@ -19,11 +19,10 @@ return function (connection, code, extension, isGzipped)
|
|||||||
|
|
||||||
local mimeType = getMimeType(extension)
|
local mimeType = getMimeType(extension)
|
||||||
|
|
||||||
connection:send("HTTP/1.0 " .. code .. " " .. getHTTPStatusString(code) .. "\r\nServer: nodemcu-httpserver\r\nContent-Type: " .. mimeType .. "\r\nnCache-Control: private, no-store\r\n")
|
connection:send("HTTP/1.0 " .. code .. " " .. getHTTPStatusString(code) .. "\r\nServer: nodemcu-httpserver\r\nContent-Type: " .. mimeType .. "\r\nCache-Control: private, no-store\r\n")
|
||||||
if isGzipped then
|
if isGzipped then
|
||||||
connection:send("Cache-Control: max-age=2592000\r\nContent-Encoding: gzip\r\n")
|
connection:send("Cache-Control: max-age=2592000\r\nContent-Encoding: gzip\r\n")
|
||||||
end
|
end
|
||||||
connection:send("Connection: close\r\n\r\n")
|
connection:send("Connection: close\r\n\r\n")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user