httpserver-static.lua 443 B

12345678910111213
  1. -- httpserver-static.lua
  2. -- Part of nodemcu-httpserver, handles sending static files to client.
  3. -- Author: Gregor Hartmann
  4. return function (connection, req, args)
  5. local buffer = dofile("httpserver-buffer.lc"):new()
  6. dofile("httpserver-header.lc")(buffer, req.code or 200, args.ext, args.isGzipped)
  7. -- Send header and return fileInfo
  8. connection:send(buffer:getBuffer())
  9. return { file = args.file, sent = 0}
  10. end