This commit is contained in:
Carl Mastrangelo 2015-09-29 10:48:24 -07:00
parent cb317c736c
commit 75e291f062
2 changed files with 7 additions and 1 deletions

View File

@ -55,6 +55,10 @@ public class GrpcSslContexts {
static final Set<String> HTTP2_VERSIONS = ImmutableSet.of("h2");
/*
* These configs use ACCEPT due to limited support in OpenSSL. Actual protocol enforcement is
* done in ProtocolNegotiators.
*/
private static ApplicationProtocolConfig ALPN = new ApplicationProtocolConfig(
Protocol.ALPN,
SelectorFailureBehavior.NO_ADVERTISE,

View File

@ -31,6 +31,8 @@
package io.grpc.netty;
import static io.grpc.netty.GrpcSslContexts.HTTP2_VERSIONS;
import com.google.common.base.Preconditions;
import io.grpc.Status;
@ -100,7 +102,7 @@ public final class ProtocolNegotiators {
if (evt instanceof SslHandshakeCompletionEvent) {
SslHandshakeCompletionEvent handshakeEvent = (SslHandshakeCompletionEvent) evt;
if (handshakeEvent.isSuccess()) {
if (GrpcSslContexts.HTTP2_VERSIONS.contains(sslHandler(ctx).applicationProtocol())) {
if (HTTP2_VERSIONS.contains(sslHandler(ctx).applicationProtocol())) {
// Successfully negotiated the protocol. Replace this handler with
// the GRPC handler.
ctx.pipeline().replace(this, null, grpcHandler);