Core, REST: Fix path segment encoding to use RFC 3986 percent-encoding#15989
Open
adutra wants to merge 1 commit intoapache:mainfrom
Open
Core, REST: Fix path segment encoding to use RFC 3986 percent-encoding#15989adutra wants to merge 1 commit intoapache:mainfrom
adutra wants to merge 1 commit intoapache:mainfrom
Conversation
This PR introduces new methods in `RESTUtil`: - `encodePathSegment`/`decodePathSegment` - `encodeNamespaceAsPathSegment`/`decodeNamespaceAsPathSegment` They use RFC 3986 percent-encoding (spaces as `%20`) instead of `application/x-www-form-urlencoded` (spaces as `+`). This PR also switches `ResourcePaths` to use the new path-segment methods, thus fixing the encoding issue on the client (encoding) side. The decoding methods are free to be used on the server side; servers should switch to them when they can/want to support the new, correct encoding. The REST TCK harness has been updated already.
6 tasks
Contributor
Author
|
A few data points: In the range of 0 to 32767, there are only 3 characters that
In particular the
And there is only one character that fails a crossed round trip, the space char (32):
This shows evidence that:
That's why it's safe to upgrade clients right away, but servers should only upgrade when they feel it's safe to do so. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces new methods in
RESTUtil:encodePathSegment/decodePathSegmentencodeNamespaceAsPathSegment/decodeNamespaceAsPathSegmentThey use RFC 3986 percent-encoding (spaces as
%20) instead ofapplication/x-www-form-urlencoded(spaces as+).This PR also switches
ResourcePathsto use the new path-segment methods, thus fixing the encoding issue on the client (encoding) side.The decoding methods are free to be used on the server side; servers should switch to them when they can/want to support the new, correct encoding. The REST TCK harness has been updated already.