Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change how the ALPN selection is done in JDK8 and before to for the usage of Jetty.
That way we do not have to delete Conscrypt anymore and it fixes the issue.
  • Loading branch information
cescoffier committed Sep 30, 2019
1 parent 00f9617 commit 5958a04
Showing 1 changed file with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import javax.net.ssl.TrustManagerFactory;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.jdk.JDK11OrLater;
import com.oracle.svm.core.jdk.JDK8OrEarlier;

import io.netty.bootstrap.AbstractBootstrapConfig;
import io.netty.bootstrap.ChannelFactory;
Expand Down Expand Up @@ -92,11 +92,6 @@ final class Target_io_netty_handler_ssl_SslHandler$SslEngineType {
}
}

@Delete
@TargetClass(className = "io.netty.handler.ssl.ConscryptAlpnSslEngine")
final class Target_io_netty_handler_ssl_ConscryptAlpnSslEngine {
}

@TargetClass(className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper", onlyWith = JDK11OrLater.class)
final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_AlpnWrapper {
@Substitute
Expand All @@ -107,6 +102,43 @@ public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,

}

@TargetClass(className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper", onlyWith = JDK8OrEarlier.class)
final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_AlpnWrapperJava8 {
@Substitute
public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,
JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) {
if (Target_io_netty_handler_ssl_JettyAlpnSslEngine.isAvailable()) {
return isServer
? (SSLEngine) (Object) Target_io_netty_handler_ssl_JettyAlpnSslEngine.newServerEngine(engine,
applicationNegotiator)
: (SSLEngine) (Object) Target_io_netty_handler_ssl_JettyAlpnSslEngine.newClientEngine(engine,
applicationNegotiator);
}
throw new RuntimeException("Unable to wrap SSLEngine of type " + engine.getClass().getName());
}

}

@TargetClass(className = "io.netty.handler.ssl.JettyAlpnSslEngine", onlyWith = JDK8OrEarlier.class)
final class Target_io_netty_handler_ssl_JettyAlpnSslEngine {
@Alias
static boolean isAvailable() {
return false;
}

@Alias
static Target_io_netty_handler_ssl_JettyAlpnSslEngine newClientEngine(SSLEngine engine,
JdkApplicationProtocolNegotiator applicationNegotiator) {
return null;
}

@Alias
static Target_io_netty_handler_ssl_JettyAlpnSslEngine newServerEngine(SSLEngine engine,
JdkApplicationProtocolNegotiator applicationNegotiator) {
return null;
}
}

@TargetClass(className = "io.netty.handler.ssl.Java9SslEngine", onlyWith = JDK11OrLater.class)
final class Target_io_netty_handler_ssl_Java9SslEngine {
@Alias
Expand Down

0 comments on commit 5958a04

Please sign in to comment.