Refactor Rack::Static and improve directory index support #403

wants to merge 1 commit into


None yet

4 participants


This patch makes the the Rack::Static code a little more efficient and readable. At the same time it adds support for existent directory index support --instead of just checking for a trailing /, failing that it will check to see if the the path is an actual directory on disk. This is indispensable in some use cases where a trailing slash can not be insured, but the directories index file still needs to be served.

If necessary I can add a new configuration option to conditionally support this new directory behavior, but I did not do so presently b/c I suspect it would be a YAGNI.


This pull request fails (merged 1fe6ef0 into edc8b92).


Doesn't look like the failing test is related to this.

Official Rack repositories member

This is going to take me quite some time to review, and as such may not make it into the most immediate release.


:-( Maybe it can be a different class at first? That would allow people to kick its tires, so to speak, without upsetting current Static based code.

Official Rack repositories member

Could we get some tests for this?


I would also like to see this tested and merged. I have a unique need to serve up directories of mirrored content and Rack::Static's :index option is only used for handling /.

Also, I'm surprised that Rack::File and Rack::Directory don't already support index lookups.

Official Rack repositories member

This needs rebasing, and it needs tests. Closing for now. Please reopen when we have tests.

@raggi raggi closed this Dec 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment