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.
This commit is contained in:
Tatsuhiro Tsujikawa 2014-06-10 23:22:52 +09:00
parent c204861dec
commit d6b5824c9c
1 changed files with 3 additions and 11 deletions

View File

@ -170,21 +170,13 @@ int alpn_select_proto_cb(SSL* ssl,
auto target_proto_len =
strlen(reinterpret_cast<const char*>(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<const unsigned char*>(proto_id);
*outlen = proto_len;