Skip to content

Conversation

@jdcormie
Copy link
Member

@jdcormie jdcormie commented Dec 13, 2025

Also adds unit tests and justification.

Both java.net.Uri and Guava's InetAddresses predate standardization of IPv6 scopes in URIs. They both emit/accept a naked % between the [square bracketed] address. This causes the current implementation to crash in io.grpc.Uri#getHost while percent decoding. RFC 6874 says that % in an IP-literal must be percent-encoded just as is done everywhere else.

RFC 3986 & 9844 say not to support scopes at all but I think we should, for feature parity with java.net.Uri.
(Other contemporary libraries take the same approach, eg https://pkg.go.dev/net/url). A future PR will provide a first-class method to convert from java.net.Uri handling all the edge cases.

And add unit tests.
@jdcormie jdcormie requested a review from ejona86 December 15, 2025 19:14
Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, include the component in the commit title. "api: Fix encoding of IPv6 scopes in Uri"

@jdcormie jdcormie merged commit 7f39805 into grpc:master Dec 16, 2025
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants