Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supporting serving an index.html for directories #902

Merged
merged 1 commit into from Feb 21, 2015

Conversation

Projects
None yet
3 participants
@MartinNowak
Copy link
Contributor

commented Nov 24, 2014

No description provided.

@s-ludwig

This comment has been minimized.

Copy link
Member

commented Dec 20, 2014

I wonder if it makes sense to define an DirectoryServeMode enum instead of the bool field, so that we could later for example add directory listing support. An alternative (or possible addition) could also be to just provide a directoryHandler delegate for user defined responses. I didn't have practical use for either of these, so I'm a bit unclear about which would be the best design, what do you think?

@MartinNowak

This comment has been minimized.

Copy link
Contributor Author

commented Dec 20, 2014

Callback sounds good, will look into it.

supporting serving an index.html for directories
- add options enum to HTTPFileServerSettings

@MartinNowak MartinNowak force-pushed the MartinNowak:index branch from 70f29e4 to 5106443 Dec 22, 2014

@MartinNowak

This comment has been minimized.

Copy link
Contributor Author

commented Dec 22, 2014

The callback solution was a bit messy (might render a page or suggest a different path) and we would have to provide default implementations for an index.html and an autoindex callback anyhow, so I went with the enum for now. It should also possible to use an URLRouter and handle directories as fallthrough.

s-ludwig added a commit that referenced this pull request Feb 21, 2015

Merge pull request #902 from MartinNowak/index
supporting serving an index.html for directories

@s-ludwig s-ludwig merged commit 3386ee8 into vibe-d:master Feb 21, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@MartinNowak MartinNowak deleted the MartinNowak:index branch Feb 23, 2015


deprecated("Use .options and HTTPFileServerOption.failIfNotFound instead.")
@property void failIfNotFound(bool val) {
if (val)

This comment has been minimized.

Copy link
@Temtaime

Temtaime Mar 22, 2015

options = (-int(val) ^ options) & HTTPFileServerOption.failIfNotFound;
Shorter and without branching.

This comment has been minimized.

Copy link
@s-ludwig

s-ludwig Mar 22, 2015

Member

Seems a little too cryptic for too little benefit, IMO. In cases where not both is possible, I personally usually favor the clearer and more readable variant over the more concise one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.