From d6b5824c9ca3e88e1f8bae9f5f70edf086188577 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 10 Jun 2014 23:22:52 +0900 Subject: [PATCH] nghttpx: Don't check TLS requirement in ALPN cb cause cipher obj is nullptr Also don't compare ALPN identifier with streq, since they are just byte string. --- src/shrpx_ssl.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index 95ac60a3..c81685b2 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -157,7 +157,7 @@ void info_callback(const SSL *ssl, int where, int ret) #if OPENSSL_VERSION_NUMBER >= 0x10002000L namespace { -int alpn_select_proto_cb(SSL* ssl, +int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, @@ -170,21 +170,13 @@ int alpn_select_proto_cb(SSL* ssl, auto target_proto_len = strlen(reinterpret_cast(target_proto_id)); - if(target_proto_len == NGHTTP2_PROTO_VERSION_ID_LEN && - memcmp(target_proto_id, NGHTTP2_PROTO_VERSION_ID, - NGHTTP2_PROTO_VERSION_ID_LEN) == 0) { - - if(!check_http2_requirement(ssl)) { - continue; - } - } - for(auto p = in, end = in + inlen; p < end;) { auto proto_id = p + 1; auto proto_len = *p; if(proto_id + proto_len <= end && - util::streq(target_proto_id, target_proto_len, proto_id, proto_len)) { + target_proto_len == proto_len && + memcmp(target_proto_id, proto_id, proto_len) == 0) { *out = reinterpret_cast(proto_id); *outlen = proto_len;