-
Notifications
You must be signed in to change notification settings - Fork 263
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
Make normalize ignore %2B in query strings #99
Conversation
In a query string, '+' is reserved as a shorthand for space, so "real" pluses encoded as %2b should be preserved during normalization: http://example.com/one%2btwo/calc?q=1%2b2+2%2b3 is normalized as: http://example.com/one+two/calc?q=1%2B2+2%2B3 Previously this would have been normalized to: http://example.com/one+two/calc?q=1+2+2+3 making '+' ambiguous.
I'm torn. This is a bug I've wanted fixed for ages and I haven't found a good way to fix it myself. But on the other hand, I really don't like the way you've used upper-case vs. lower-case as semantically meaningful, and I simply can't merge this as-is. |
Hi, thanks for the response. Case should not be semantically meaningful:
is normalized to
for example. Percent encodings are upcased as part of normalization, which I believe is the current/expected behavior. |
Oh man, total code-read fail on my part. I read |
Awesome, thanks, I'll fix that. |
Also I'd like to see tests that include both |
There should probably be a test for any method that takes a |
Awesome, will add those. |
Instead of upcasing leave_encoded characters inside the unencode call, leave them as they are and pass the list on to encode_component for upcasing. This encapsulation keeps unencode free of any normalization logic. Also added some more test cases around leave_encoded handling.
I moved the upcasing out of |
LGTM. |
Make normalize ignore %2B in query strings
In a query string, '+' is reserved as a shorthand for space, so "real"
pluses encoded as %2b should be preserved during normalization:
http://example.com/one%2btwo/calc?q=1%2b2+2%2b3
is normalized as:
http://example.com/one+two/calc?q=1%2B2+2%2B3
Previously this would have been normalized to:
http://example.com/one+two/calc?q=1+2+2+3
making '+' ambiguous.
This fixes #50.