httpserver-error.lua 495 B

123456789
  1. -- httpserver-error.lua
  2. -- Part of nodemcu-httpserver, handles sending error pages to client.
  3. -- Author: Marcos Kirsch, Gregor Hartmann
  4. return function (connection, req, args)
  5. req.code = args.code
  6. local statusString = dofile("httpserver-header.lc")(connection, req.code, "html", false, req.headers)
  7. connection:send("<html><head><title>" .. req.code .. " - " .. statusString .. "</title></head><body><h1>" .. req.code .. " - " .. statusString .. "</h1></body></html>\r\n")
  8. end