Fix for ipv6 link local with scope (#9326)

This commit is contained in:
Jader Alcântara 2022-07-07 10:57:04 -03:00 committed by GitHub
parent 3e09ea0068
commit c1abc7f8ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,8 @@ package io.grpc.okhttp;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.net.HostAndPort;
import com.google.common.net.InetAddresses;
import io.grpc.internal.GrpcUtil;
import io.grpc.okhttp.internal.OptionalMethod;
import io.grpc.okhttp.internal.Platform;
@ -247,7 +249,9 @@ class OkHttpProtocolNegotiator {
} else {
SET_USE_SESSION_TICKETS.invokeOptionalWithoutCheckedException(sslSocket, true);
}
if (SET_SERVER_NAMES != null && SNI_HOST_NAME != null) {
if (SET_SERVER_NAMES != null
&& SNI_HOST_NAME != null
&& !InetAddresses.isInetAddress(HostAndPort.fromString(hostname).getHost())) {
SET_SERVER_NAMES
.invoke(sslParams, Collections.singletonList(SNI_HOST_NAME.newInstance(hostname)));
} else {