-
Notifications
You must be signed in to change notification settings - Fork 282
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
Support path normalization before matching routes #737
base: master
Are you sure you want to change the base?
Conversation
…representation before dispatching the query to URLRouter.
…railing slash. See also #737.
Some thoughts:
|
Regarding this situation, the RESTful moto is:
However, for ease of use, some (most?) of the frameworks out there allow the lack of (or sometimes an optional) trailing slash. Considering vibe.d, IMHO, the only case where path shouldn't be normalized is when serving files. I can't see any healthy behavior where resource So I would be in favor of integrating this to |
Regarding the trailing slash, But I'd keep this separate from the issue of resolving
Actually, paths are now always normalized in the file server, so that potentially malicious paths outside of the served directory can be recognized, so it would fit in well there. |
Is it still something you'd be keen to accept ? This path issue is becoming more and more present on my end and I'm also quite interested in #1062 . |
Adds support for path normalization (fixes #667) by adding a new class,
NormalizedURLRouter
. Rationale for using a new class:URLRouter
to encapsulate only the logic for matching routes, and lets another class deal with what paths are considered canonical.Several sites claim that redirects are better for SEO, but several documents show that there are multiple solutions to this (e.g.
rel="canonical"
links, sitemaps). Perhaps redirects should be an optional mode forNormalizedURLRouter
, but for now I think a simpler and slightly faster default would be to avoid the redirect.For now, the only normalization performed is to resolve
..
,.
, and/
.