Commit 19b4da64 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Support h3-29

parent 886dc93f
...@@ -703,20 +703,26 @@ namespace { ...@@ -703,20 +703,26 @@ 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) {
for (auto p = in, end = in + inlen; p < end;) { constexpr StringRef alpnlist[] = {
auto proto_id = p + 1; StringRef::from_lit("h3"),
auto proto_len = *p; StringRef::from_lit("h3-29"),
};
if (proto_id + proto_len <= end && for (auto &alpn : alpnlist) {
util::streq_l("h3", StringRef{proto_id, proto_len})) { for (auto p = in, end = in + inlen; p < end;) {
auto proto_id = p + 1;
auto proto_len = *p;
*out = reinterpret_cast<const unsigned char *>(proto_id); if (alpn.size() == proto_len &&
*outlen = proto_len; memcmp(alpn.byte(), proto_id, alpn.size()) == 0) {
*out = proto_id;
*outlen = proto_len;
return SSL_TLSEXT_ERR_OK; return SSL_TLSEXT_ERR_OK;
} }
p += 1 + proto_len; p += 1 + proto_len;
}
} }
return SSL_TLSEXT_ERR_ALERT_FATAL; return SSL_TLSEXT_ERR_ALERT_FATAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment