Fix ALPN handling
diff --git a/examples/client.cc b/examples/client.cc
index 684ebff..e9e3385 100644
--- a/examples/client.cc
+++ b/examples/client.cc
@@ -899,8 +899,8 @@
switch (version_) {
case NGTCP2_PROTO_VER_D19:
- alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_D19);
- alpnlen = str_size(NGTCP2_ALPN_D19);
+ alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_H3);
+ alpnlen = str_size(NGTCP2_ALPN_H3);
break;
}
if (alpn) {
diff --git a/examples/server.cc b/examples/server.cc
index 6467605..355cfed 100644
--- a/examples/server.cc
+++ b/examples/server.cc
@@ -3411,8 +3411,8 @@
switch (version) {
case NGTCP2_PROTO_VER_D19:
- alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_D19);
- alpnlen = str_size(NGTCP2_ALPN_D19);
+ alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_H3);
+ alpnlen = str_size(NGTCP2_ALPN_H3);
break;
default:
if (!config.quiet) {
@@ -3429,16 +3429,13 @@
return SSL_TLSEXT_ERR_OK;
}
}
- // Just select alpn for now.
- *out = reinterpret_cast<const uint8_t *>(alpn + 1);
- *outlen = alpn[0];
if (!config.quiet) {
- std::cerr << "Client did not present ALPN " << NGTCP2_ALPN_D19 + 1
+ std::cerr << "Client did not present ALPN " << NGTCP2_ALPN_H3 + 1
<< std::endl;
}
- return SSL_TLSEXT_ERR_OK;
+ return SSL_TLSEXT_ERR_NOACK;
}
} // namespace
diff --git a/lib/includes/ngtcp2/ngtcp2.h b/lib/includes/ngtcp2/ngtcp2.h
index 9b64c7f..dc2c525 100644
--- a/lib/includes/ngtcp2/ngtcp2.h
+++ b/lib/includes/ngtcp2/ngtcp2.h
@@ -161,10 +161,10 @@
supports. */
#define NGTCP2_PROTO_VER_MAX NGTCP2_PROTO_VER_D19
-/* NGTCP2_ALPN_* is a serialized form of ALPN protocol identifier this
- library supports. Notice that the first byte is the length of the
- following protocol identifier. */
-#define NGTCP2_ALPN_D19 "\x5h3-19"
+/* NGTCP2_ALPN_H3 is a serialized form of HTTP/3 ALPN protocol
+ identifier this library supports. Notice that the first byte is
+ the length of the following protocol identifier. */
+#define NGTCP2_ALPN_H3 "\x5h3-19"
#define NGTCP2_MAX_PKTLEN_IPV4 1252
#define NGTCP2_MAX_PKTLEN_IPV6 1232