Upgrading Jetty alpn-api version

Motivation:

Discussion is in https://github.com/jetty-project/jetty-alpn/issues/8. The new API allows protocol negotiation to properly throw SSLHandshakeException.

Modifications:

Updated the parent pom.xml with the new version.

Result:

Upgraded alpn-api now allows throwing SSLHandshakeException.
This commit is contained in:
nmittler 2015-05-22 08:34:16 -07:00
parent c20b38378b
commit e4af176be7
2 changed files with 19 additions and 14 deletions

View File

@ -16,20 +16,18 @@
package io.netty.handler.ssl;
import static io.netty.util.internal.ObjectUtil.checkNotNull;
import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector;
import io.netty.util.internal.PlatformDependent;
import java.util.LinkedHashSet;
import java.util.List;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import org.eclipse.jetty.alpn.ALPN;
import org.eclipse.jetty.alpn.ALPN.ClientProvider;
import org.eclipse.jetty.alpn.ALPN.ServerProvider;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import java.util.LinkedHashSet;
import java.util.List;
final class JdkAlpnSslEngine extends JdkSslEngine {
private static boolean available;
@ -62,12 +60,15 @@ final class JdkAlpnSslEngine extends JdkSslEngine {
"protocolSelector");
ALPN.put(engine, new ServerProvider() {
@Override
public String select(List<String> protocols) {
public String select(List<String> protocols) throws SSLException {
try {
return protocolSelector.select(protocols);
} catch (SSLException e) {
throw e;
} catch (Throwable t) {
PlatformDependent.throwException(t);
return null;
// Ensure that all exceptions are propagated as SSLExceptions
// so that the SslHandler properly fails the handshake.
throw new SSLException(t);
}
}
@ -87,11 +88,15 @@ final class JdkAlpnSslEngine extends JdkSslEngine {
}
@Override
public void selected(String protocol) {
public void selected(String protocol) throws SSLException {
try {
protocolListener.selected(protocol);
} catch (SSLException e) {
throw e;
} catch (Throwable t) {
PlatformDependent.throwException(t);
// Ensure that all exceptions are propagated as SSLExceptions
// so that the SslHandler properly fails the handshake.
throw new SSLException(t);
}
}

View File

@ -667,7 +667,7 @@
<dependency>
<groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>alpn-api</artifactId>
<version>1.1.0.v20141014</version>
<version>1.1.2.v20150522</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty.alpn</groupId>