diff --git a/httpserver-static.lua b/httpserver-static.lua index 9140b86..178b17b 100644 --- a/httpserver-static.lua +++ b/httpserver-static.lua @@ -4,14 +4,18 @@ return function (connection, req, args) --print("Begin sending:", args.file) + --print("node.heap(): ", node.heap()) dofile("httpserver-header.lc")(connection, 200, args.ext, args.isGzipped) -- Send file in little chunks local continue = true local size = file.list()[args.file] local bytesSent = 0 - local chunkSize = 1024 -- @TODO: can chunkSize be larger? + -- Chunks larger than 1024 don't work. + -- https://github.com/nodemcu/nodemcu-firmware/issues/1075 + local chunkSize = 1024 while continue do collectgarbage() + -- NodeMCU file API lets you open 1 file at a time. -- So we need to open, seek, close each time in order -- to support multiple simultaneous clients.