Skip to content

Check method in ServeDir#249

Merged
davidpdrsn merged 2 commits intomasterfrom
serve-dir-method-not-allowed
Apr 24, 2022
Merged

Check method in ServeDir#249
davidpdrsn merged 2 commits intomasterfrom
serve-dir-method-not-allowed

Conversation

@davidpdrsn
Copy link
Member

Motivation

Methods outside of GET and HEAD don't make much sense for serving static files but ServeDir (and therefore also ServeFile) would just accept all methods.

Solution

Check the method in ServeDir and respond with 405 Method Not Allowed if its not GET or HEAD. A response is immediately returned without calling the fallback.

@davidpdrsn davidpdrsn requested review from Nehliin and jplatte April 24, 2022 16:32
@davidpdrsn davidpdrsn enabled auto-merge (squash) April 24, 2022 16:32
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
@davidpdrsn davidpdrsn merged commit 4904b86 into master Apr 24, 2022
@davidpdrsn davidpdrsn deleted the serve-dir-method-not-allowed branch April 24, 2022 19:05
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.

2 participants