Skip to content

Commit

Permalink
Remove Jetty NPN and ALPN support (#14049)
Browse files Browse the repository at this point in the history
Motivation:
At this point, the JDK and OpenSSL both natively support ALPN, which
effectively means that ALPN is always available. NPN itself has been
obsolete for nearly 15 years, since the release of ALPN and its
subsequent widespread support. We no longer need Jetty to do ALPN or NPN
for us.

Modification:
Remove all code, build properties, and dependencies related to Jetty NPN
and ALPN.

Result:
This removes deprecated code and obsoleted features, and makes our
pom.xml files cleaner.
  • Loading branch information
chrisvest committed May 11, 2024
1 parent f7eb1e7 commit b619a06
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 615 deletions.
4 changes: 0 additions & 4 deletions example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@
<artifactId>${conscrypt.artifactId}</artifactId>
<classifier>${conscrypt.classifier}</classifier>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.npn</groupId>
<artifactId>npn-api</artifactId>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@
<artifactId>bctls-jdk18on</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.npn</groupId>
<artifactId>npn-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>alpn-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${conscrypt.groupId}</groupId>
<artifactId>${conscrypt.artifactId}</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicationProtocolNegotiator {
private static final boolean AVAILABLE = Conscrypt.isAvailable() ||
JdkAlpnSslUtils.supportsAlpn() ||
JettyAlpnSslEngine.isAvailable() ||
BouncyCastle.isAvailable();

private static final SslEngineWrapperFactory ALPN_WRAPPER = AVAILABLE ? new AlpnWrapper() : new FailureWrapper();
Expand Down Expand Up @@ -144,10 +143,6 @@ public SSLEngine wrapSslEngine(SSLEngine engine, BufferAllocator alloc,
if (JdkAlpnSslUtils.supportsAlpn()) {
return new JdkAlpnSslEngine(engine, applicationNegotiator, isServer);
}
if (JettyAlpnSslEngine.isAvailable()) {
return isServer ? JettyAlpnSslEngine.newServerEngine(engine, applicationNegotiator)
: JettyAlpnSslEngine.newClientEngine(engine, applicationNegotiator);
}
throw new UnsupportedOperationException("ALPN not supported. Unable to wrap SSLEngine of type '"
+ engine.getClass().getName() + "')");
}
Expand Down

This file was deleted.

24 changes: 1 addition & 23 deletions handler/src/main/java/io/netty5/handler/ssl/JdkSslContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,31 +414,9 @@ static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig c
.append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString());
}
}
case NPN:
if (isServer) {
switch(config.selectedListenerFailureBehavior()) {
case ACCEPT:
return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols());
case FATAL_ALERT:
return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols());
default:
throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
.append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString());
}
} else {
switch(config.selectorFailureBehavior()) {
case FATAL_ALERT:
return new JdkNpnApplicationProtocolNegotiator(true, config.supportedProtocols());
case NO_ADVERTISE:
return new JdkNpnApplicationProtocolNegotiator(false, config.supportedProtocols());
default:
throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
.append(config.selectorFailureBehavior()).append(" failure behavior").toString());
}
}
default:
throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ")
.append(config.protocol()).append(" protocol").toString());
.append(config.protocol()).append(" protocol").toString());
}
}

Expand Down
146 changes: 0 additions & 146 deletions handler/src/main/java/io/netty5/handler/ssl/JettyAlpnSslEngine.java

This file was deleted.

0 comments on commit b619a06

Please sign in to comment.