return function (connection, req, args)
dofile("httpserver-header.lc")(connection, 200, 'html')
connection:send([===[
Server File Listing
Server File Listing
]===])
local remaining, used, total = file.fsinfo()
connection:send("Total size: " .. total .. " bytes
\n" ..
"In Use: " .. used .. " bytes
\n" ..
"Free: " .. remaining .. " bytes
\n")
local flashAddress, flashSize = file.fscfg ()
connection:send("Flash Address: " .. flashAddress .. " bytes
\n" ..
"Flash Size: " .. flashSize .. " bytes
\n")
connection:send("\nFiles:
\n
\n")
for name, size in pairs(file.list()) do
local isHttpFile = string.match(name, "(http/)") ~= nil
if isHttpFile then
local url = string.match(name, ".*/(.*)")
connection:send(' - ' .. url .. " (" .. size .. " bytes)
\n")
end
end
connection:send("
\n\n")
end