Skip to content

Commit 65b32e6

Browse files
authoredDec 5, 2024··
okhttp: Fix for ipv6 link local with scope (#11725)
1 parent c080b52 commit 65b32e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎okhttp/src/main/java/io/grpc/okhttp/OkHttpProtocolNegotiator.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

2121
import com.google.common.annotations.VisibleForTesting;
22+
import com.google.common.net.HostAndPort;
23+
import com.google.common.net.InetAddresses;
2224
import io.grpc.internal.GrpcUtil;
2325
import io.grpc.okhttp.internal.OptionalMethod;
2426
import io.grpc.okhttp.internal.Platform;
@@ -247,7 +249,9 @@ protected void configureTlsExtensions(
247249
} else {
248250
SET_USE_SESSION_TICKETS.invokeOptionalWithoutCheckedException(sslSocket, true);
249251
}
250-
if (SET_SERVER_NAMES != null && SNI_HOST_NAME != null) {
252+
if (SET_SERVER_NAMES != null
253+
&& SNI_HOST_NAME != null
254+
&& !InetAddresses.isInetAddress(HostAndPort.fromString(hostname).getHost())) {
251255
SET_SERVER_NAMES
252256
.invoke(sslParams, Collections.singletonList(SNI_HOST_NAME.newInstance(hostname)));
253257
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.