-
Notifications
You must be signed in to change notification settings - Fork 37
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
whitespaces encode to %20
#16
Comments
As discussed privately, I don't think percent-decoding is something |
Hi @ibraheemdev, do you remember the details of why you decided against this? From what I understand, percent encoding is part of RFC 3986 so I thought it would be in scope but then I found this. |
Matchit isn't necessarily http specific, so implicit percent-encoding/decoding could cause unexpected behavior. My understanding was that routes could either be percent encoded before being passed to matchit, or paths decoded before being matched. |
From what I understand, percent encoding should be general for all URIs regardless of whether they are http. That said it might apply to some narrower definition of URI used by IETF than is used in the real world. I think that the complexity with decoding the path before passing it into matching is that slashes may also be encoded but these should not be simply passed to the router. So I think it should be possible to split a path by slashes, then decode each segment without decoding slashes, join it together again and then pass that into matchit. I didn't yet look into if there may be other characters that should also be handled specially. I feel like this would be something that could be used fairly often. Would it be ok with you to add an option or some kind of wrapper for percent encoding support into matchit or would you rather the users or some 3rd party wrappers handled that? |
@mladedav I would be fine with adding a helper function that percent decodes paths excluding a few reserved characters that would affect parsing (/,?). Actix-web takes a similar approach https://github.com/actix/actix-web/blob/master/actix-router/src/quoter.rs. |
I think
(whitespace) should be encoded as
%20
,which will works onURL
that contains whitespaces.I test on
julienschmidt/httprouter
,thehttp://127.0.0.1:3000/hell o/name
works, butmatchit
not.Or there are some misusage for me.
The text was updated successfully, but these errors were encountered: