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

MartinNowak
Copy link
Contributor

No description provided.

@s-ludwig
Copy link
Member

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
Copy link
Contributor Author

Callback sounds good, will look into it.

- add options enum to HTTPFileServerSettings
@MartinNowak
Copy link
Contributor Author

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
supporting serving an index.html for directories
@s-ludwig s-ludwig merged commit 3386ee8 into vibe-d:master Feb 21, 2015
@MartinNowak MartinNowak deleted the index branch February 23, 2015 14:57

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants