mg.write("HTTP/1.0 200 OK\r\n") mg.write("Content-Type: text/html\r\n") mg.write("\r\n") mg.write([[

This is Lua script example 2, served by the CivetWeb web server, version ]] .. mg.version .. [[.

The following features are available:

\n"); mg.write("

Today is " .. os.date("%A") .. "

\n"); -- Request content mg.write("\n
\n") l = mg.request_info.content_length if l then mg.write("

Content-Length = "..l..":
\n

\n")
  mg.write(mg.read())
  mg.write("\n
\n

\n") else mg.write("

not request content available

\n") end -- Directory listing mg.write("\n
\n") mg.write("

\n"); if not lfs then mg.write("lfs not available\n") else mg.write("Files in " .. lfs.currentdir()) mg.write("\n

\n") mg.write(string.format("\n", cnt)) end mg.write([[

]])