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:
parent
90adae7b32
commit
2ca6a70211
@ -16,20 +16,18 @@
|
|||||||
package io.netty.handler.ssl;
|
package io.netty.handler.ssl;
|
||||||
|
|
||||||
import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
||||||
|
|
||||||
import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
|
import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
|
||||||
import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector;
|
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;
|
||||||
import org.eclipse.jetty.alpn.ALPN.ClientProvider;
|
import org.eclipse.jetty.alpn.ALPN.ClientProvider;
|
||||||
import org.eclipse.jetty.alpn.ALPN.ServerProvider;
|
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 {
|
final class JdkAlpnSslEngine extends JdkSslEngine {
|
||||||
private static boolean available;
|
private static boolean available;
|
||||||
|
|
||||||
@ -62,12 +60,15 @@ final class JdkAlpnSslEngine extends JdkSslEngine {
|
|||||||
"protocolSelector");
|
"protocolSelector");
|
||||||
ALPN.put(engine, new ServerProvider() {
|
ALPN.put(engine, new ServerProvider() {
|
||||||
@Override
|
@Override
|
||||||
public String select(List<String> protocols) {
|
public String select(List<String> protocols) throws SSLException {
|
||||||
try {
|
try {
|
||||||
return protocolSelector.select(protocols);
|
return protocolSelector.select(protocols);
|
||||||
|
} catch (SSLException e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
PlatformDependent.throwException(t);
|
// Ensure that all exceptions are propagated as SSLExceptions
|
||||||
return null;
|
// so that the SslHandler properly fails the handshake.
|
||||||
|
throw new SSLException(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,11 +88,15 @@ final class JdkAlpnSslEngine extends JdkSslEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selected(String protocol) {
|
public void selected(String protocol) throws SSLException {
|
||||||
try {
|
try {
|
||||||
protocolListener.selected(protocol);
|
protocolListener.selected(protocol);
|
||||||
|
} catch (SSLException e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable t) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -652,7 +652,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||||
<artifactId>alpn-api</artifactId>
|
<artifactId>alpn-api</artifactId>
|
||||||
<version>1.1.0.v20141014</version>
|
<version>1.1.2.v20150522</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mortbay.jetty.alpn</groupId>
|
<groupId>org.mortbay.jetty.alpn</groupId>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user