4 Dumps all the published links
6 function dump_files(t, r, dir)
7 for _, f in ipairs(r:get_direntries(dir)) do
8 if f ~= "." and f ~= ".." then
9 local filepath = dir .. "/" .. f
10 local info = r:stat(filepath)
12 -- if this is a file, then add it to the table!
13 if info.filetype == 1 then
17 -- if this is a dir, then descend into it
18 if info.filetype == 2 then
19 dump_files(t, r, filepath)
27 r.content_type = "text/plain"
29 if r.method == 'GET' then
31 dump_files(links, r, r.document_root)
33 for filepath, info in pairs(links) do
34 r:puts( ("%s\n"):format(
35 filepath:gsub(r.document_root, r.server_name .. ":" ..r.port)