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
potPourriB.dhallb: Fix encoding of query string #655
Conversation
Original URL (potPourriA.dhall): https://-._~%2C!$&'*+;=:@0abc1--12a------a-a--a-0/foo?/-._~%2C!$&'*+;=:@/? JSON representation of the original binary: [ 24, null, 0, 1, null, "-._~%2C!$&'*+;=:@0abc1--12a------a-a--a-0", "foo", "/-._~%2C!$&%27*+;=:@/?" ] JSON representation of the new binary: [ 24, null, 0, 1, null, "-._~%2C!$&'*+;=:@0abc1--12a------a-a--a-0", "foo", "/-._~%2C!$&'*+;=:@/?" ] Diff: 9c9 < "/-._~%2C!$&%27*+;=:@/?" --- > "/-._~%2C!$&'*+;=:@/?" The query string was incorrectly percent-encoded.
+ should be percent-encoded because some servers interpret it as a space, following the CGI spec
|
That's an unrelated potential standard change, right? Currently dhall-lang/standard/dhall.abnf Lines 587 to 597 in 5ca75a9
|
Query strings should be treated as opaque strings, and not decoded or encoded. We have It makes sense for us to decode and encode path segments, because we convert local paths to URL paths, which is an operation which involves manipulating the contents of a path. But we don't ever do any manipulation of the contents of a query string, so we should just pass whatever the user gave us around in unmodified form. Introducing percent-decoding or -encoding here just feels unnecessary and a source of subtle bugs; especially since (as you point out) the rules for percent-encoding and -decoding query strings are not the same as for paths. |
Corresponding change to the standard: dhall-lang/dhall-lang#627 The potPourri parser test remains disabled due to dhall-lang/dhall-lang#655. Fixes #1110.
Corresponding change to the standard: dhall-lang/dhall-lang#627 The potPourri parser test remains disabled due to dhall-lang/dhall-lang#655. Fixes #1110.
Note that, before #627, the |
@sjakobi: My understanding is that what is currently in Also, in general the current standardization trend is towards preserving the original URL as much as possible (i.e. not percent-encoding the query fragment). See #581 for the roadmap of URL-related changes |
No. As I tried to point out in the PR description, This PR will fix this. |
@sjakobi: Oh, I misread. Yeah, then this looks good to me |
Original URL (potPourriA.dhall):
JSON representation of the original binary:
JSON representation of the new binary:
Diff:
The query string was incorrectly percent-encoded.