Merge pull request #45 from IntelliDust/master
Added handling of watchdog for serving bigger files
This commit is contained in:
commit
8715123904
@ -23,6 +23,7 @@ return function (connection, code, extension, gzip)
|
|||||||
|
|
||||||
connection:send("HTTP/1.0 " .. code .. " " .. getHTTPStatusString(code) .. "\r\nServer: nodemcu-httpserver\r\nContent-Type: " .. mimeType["contentType"] .. "\r\n")
|
connection:send("HTTP/1.0 " .. code .. " " .. getHTTPStatusString(code) .. "\r\nServer: nodemcu-httpserver\r\nContent-Type: " .. mimeType["contentType"] .. "\r\n")
|
||||||
if gzip then
|
if gzip then
|
||||||
|
connection:send("Cache-Control: max-age=2592000\r\n")
|
||||||
connection:send("Content-Encoding: gzip\r\n")
|
connection:send("Content-Encoding: gzip\r\n")
|
||||||
end
|
end
|
||||||
connection:send("Connection: close\r\n\r\n")
|
connection:send("Connection: close\r\n\r\n")
|
||||||
|
|||||||
@ -23,6 +23,7 @@ return function (connection, req, args)
|
|||||||
connection:send(chunk)
|
connection:send(chunk)
|
||||||
bytesSent = bytesSent + #chunk
|
bytesSent = bytesSent + #chunk
|
||||||
chunk = nil
|
chunk = nil
|
||||||
|
tmr.wdclr() -- loop can take a while for long files. tmr.wdclr() prevent watchdog to restart module
|
||||||
--print("Sent" .. args.file, bytesSent)
|
--print("Sent" .. args.file, bytesSent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user