Rack::Directory serves entries below the
root given, according to the path info of the Rack request. If a directory is found, the file's
contents will be presented in an html based index. If a file is found, the
env will be passed to the specified app.
If app is not specified, a Rack::File of
the same root will be used.
TODO: add correct response if not readable, not sure if 404 is the best
option
# File lib/rack/directory.rb, line 115deflist_path@stat = F.stat(@path)
if@stat.readable?return@app.call(@env) if@stat.file?returnlist_directoryif@stat.directory?elseraiseErrno::ENOENT, 'No such file or directory'endrescueErrno::ENOENT, Errno::ELOOPreturnentity_not_foundend
stat(node, max = 10)click to toggle source
# File lib/rack/directory.rb, line 107defstat(node, max = 10)
F.stat(node)
rescueErrno::ENOENT, Errno::ELOOPreturnnilend