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

Avoid re-opening files when serving from a directory #42

Merged
merged 1 commit into from Oct 2, 2015

Conversation

@kanongil
Copy link
Member

kanongil commented Sep 27, 2015

The file prepare phase is inadvertently called twice for the same file when served via the directory handler.

This patch fixes the issue by skipping the prepare phase once the response has been submitted. I have added an additional test to verify this behavior.

This issue is mostly a performance problem, though it can in extreme cases cause incorrect behavior if the file is moved / deleted between the two calls to the prepare function.

@kanongil kanongil added the bug label Sep 27, 2015
@kanongil kanongil added this to the 3.0.2 milestone Oct 2, 2015
kanongil added a commit that referenced this pull request Oct 2, 2015
Avoid re-opening files when serving from a directory
@kanongil kanongil merged commit 10c7a3a into hapijs:master Oct 2, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.