RFR: 8272702: Resolving URI relative path with no / may lead to incorrect toString [v4]
Michael McMahon
michaelm at openjdk.org
Thu Aug 11 13:55:40 UTC 2022
On Tue, 9 Aug 2022 11:02:31 GMT, KIRIYAMA Takuya <duke at openjdk.org> wrote:
>> Consider an authority component without trailing "/" as a base URI. When resolving a relative path against this base URI, the resulting URI is a concatenated URI without "/".
>> This behaviour should be fixed, which is rationalized by rfc3986#section-5.2.3.
>> Could you review this fix?
>
> KIRIYAMA Takuya has updated the pull request incrementally with one additional commit since the last revision:
>
> 8272702: Resolving URI relative path with no / may lead to incorrect toString
Marked as reviewed by michaelm (Reviewer).
I've thought about this some more and it does seem like the intent of RFC 2396 is clearly that an absolute URI should always have an absolute path (beginning with "/"). This implies when resolving a relative reference such as "test" against an absolute URI with an empty path, this implies a "/" needs to be added. RFC 3986 makes this explicit.
Existing code is probably working around the issue by adding a "/" explicitly when none present prior to resolution of the reference. I think we should go ahead with the change and I'm happy to sponsor it.
-------------
PR: https://git.openjdk.org/jdk/pull/8899
More information about the net-dev
mailing list