-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Draft] Include ':' and '@' in pchar definition for url encoding #2298
Conversation
Generate changelog in
|
Also relevant in RFC 3986 Section 2.4. When to Encode or Decode which seems to indicate that it should be valid to percent-encode the colon in the path component part, though it would not be required as it is not an unreserved character
|
We attempt to aggressively encode parameters because not all server implementations implement the same spec (or do so correctly). For most known server implementations, this produces slightly more verbose, but less ambiguous results. It's possible that this proposal wouldn't harm compatibility with known webservers, but that's difficult to know ahead of time |
We're planning to partially implement this in #2360 as it has come up a few more times. Only for colon, not |
Nice! Looking forward to deleting my forked class 🎉 Will close this in favor of the other PR. Thanks for pushing this through! |
Before this PR
Putting this up for potential discussion - not sure if we actually want to make this change.
Context: We ran into the case where requests of a dialogue client get rejected by google-container-registry because dialogue would url encode the colon
:
in path segments (e.g.sha256:c48bxxx
) while GCR only accepts non-encoded:
in path segments.Looking into Dialogue's url encoding, I noticed that Dialogue's implementation doesn't fully match the referenced RFC-3986. Most notably, Dialogue is defining the pchar matcher as
pchar = unreserved
, while the RFC is a bit more permissive here and also includes sub-delims,:
, and@
:Note that we have another explicit divergence for query params but this one is well documented and for compatibility reasons:
dialogue/dialogue-core/src/main/java/com/palantir/dialogue/core/BaseUrl.java
Lines 247 to 251 in 05ea071
Unclear points:
pchar
also includes sub-delims. But given the comment above, it seems like we want to purposfully encode sub-delims?After this PR
Extend the pchar matcher to also include
:
and@
. This will result in those characters no longer being url encoded in path segments.==COMMIT_MSG==
Include ':' and '@' in pchar definition for url encoding
==COMMIT_MSG==
Possible downsides?