This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-grpc.git
The following commit(s) were added to refs/heads/main by this push:
new 513a1c3f revert grpc breaking netty tls change (#200)
513a1c3f is described below
commit 513a1c3f7a9a3f8e357f7a87e6dd8098b4b694b3
Author: PJ Fanning <[email protected]>
AuthorDate: Tue Dec 26 09:15:43 2023 +0100
revert grpc breaking netty tls change (#200)
* revert grpc breaking netty tls change
* Update NettyClientUtils.scala
---
.../pekko/grpc/internal/NettyClientUtils.scala | 34 +++++++++++-----------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git
a/runtime/src/main/scala/org/apache/pekko/grpc/internal/NettyClientUtils.scala
b/runtime/src/main/scala/org/apache/pekko/grpc/internal/NettyClientUtils.scala
index 7d27799a..07b1d8a3 100644
---
a/runtime/src/main/scala/org/apache/pekko/grpc/internal/NettyClientUtils.scala
+++
b/runtime/src/main/scala/org/apache/pekko/grpc/internal/NettyClientUtils.scala
@@ -182,23 +182,23 @@ object NettyClientUtils {
*/
@InternalApi
private def createNettySslContext(javaSslContext: SSLContext): SslContext = {
- import io.grpc.netty.shaded.io.netty.handler.ssl.{
- ApplicationProtocolConfig,
- ClientAuth,
- IdentityCipherSuiteFilter,
- JdkSslContext
- }
- // See
- //
https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java#L229-L309
- new JdkSslContext(
- javaSslContext,
- /* boolean isClient */ true,
- /* Iterable<String> ciphers */ null, // use JDK defaults (null is
accepted as indicated in constructor Javadoc)
- IdentityCipherSuiteFilter.INSTANCE,
- /* ApplicationProtocolConfig apn */ ApplicationProtocolConfig.DISABLED,
// use JDK default (null would also be acceptable, DISABLED config will select
the NONE protocol and thus the JdkDefaultApplicationProtocolNegotiator)
- ClientAuth.NONE, // server-only option, which is ignored as
isClient=true (as indicated in constructor Javadoc)
- /* String[] protocols */ null, // use JDK defaults (null is accepted as
indicated in constructor Javadoc)
- /* boolean startTls */ false)
+ import io.grpc.netty.shaded.io.netty.handler.ssl.{ JdkSslContext,
SslProvider }
+ import java.lang.reflect.Field
+
+ // This is a hack for situations where the SSLContext is given.
+ // This approach forces using SslProvider.JDK, which is known not to work
+ // on JDK 1.8.0_252
+
+ // Create a Netty JdkSslContext object with all the correct ciphers,
protocol settings, etc initialized.
+ val nettySslContext: JdkSslContext =
+ GrpcSslContexts.configure(GrpcSslContexts.forClient,
SslProvider.JDK).build.asInstanceOf[JdkSslContext]
+
+ // Patch the SSLContext value inside the JdkSslContext object
+ val nettySslContextField: Field =
classOf[JdkSslContext].getDeclaredField("sslContext")
+ nettySslContextField.setAccessible(true)
+ nettySslContextField.set(nettySslContext, javaSslContext)
+
+ nettySslContext
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]