nghttpx: Support h3-29
This commit is contained in:
parent
886dc93f18
commit
19b4da6401
|
@ -703,14 +703,19 @@ namespace {
|
||||||
int quic_alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
|
int quic_alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
|
||||||
unsigned char *outlen, const unsigned char *in,
|
unsigned char *outlen, const unsigned char *in,
|
||||||
unsigned int inlen, void *arg) {
|
unsigned int inlen, void *arg) {
|
||||||
|
constexpr StringRef alpnlist[] = {
|
||||||
|
StringRef::from_lit("h3"),
|
||||||
|
StringRef::from_lit("h3-29"),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto &alpn : alpnlist) {
|
||||||
for (auto p = in, end = in + inlen; p < end;) {
|
for (auto p = in, end = in + inlen; p < end;) {
|
||||||
auto proto_id = p + 1;
|
auto proto_id = p + 1;
|
||||||
auto proto_len = *p;
|
auto proto_len = *p;
|
||||||
|
|
||||||
if (proto_id + proto_len <= end &&
|
if (alpn.size() == proto_len &&
|
||||||
util::streq_l("h3", StringRef{proto_id, proto_len})) {
|
memcmp(alpn.byte(), proto_id, alpn.size()) == 0) {
|
||||||
|
*out = proto_id;
|
||||||
*out = reinterpret_cast<const unsigned char *>(proto_id);
|
|
||||||
*outlen = proto_len;
|
*outlen = proto_len;
|
||||||
|
|
||||||
return SSL_TLSEXT_ERR_OK;
|
return SSL_TLSEXT_ERR_OK;
|
||||||
|
@ -718,6 +723,7 @@ int quic_alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
|
||||||
|
|
||||||
p += 1 + proto_len;
|
p += 1 + proto_len;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SSL_TLSEXT_ERR_ALERT_FATAL;
|
return SSL_TLSEXT_ERR_ALERT_FATAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue