Merge pull request #2532 from nghttp2/adopt-nghttp3_conn_read_stream2

src: Adopt nghttp3_conn_read_stream2
This commit is contained in:
Tatsuhiro Tsujikawa
2025-09-25 20:31:28 +09:00
committed by GitHub
4 changed files with 16 additions and 15 deletions

View File

@@ -127,8 +127,8 @@ following libraries are required:
wolfSSL; or LibreSSL (does not support 0RTT); or aws-lc; or wolfSSL; or LibreSSL (does not support 0RTT); or aws-lc; or
`BoringSSL <https://boringssl.googlesource.com/boringssl/>`_ (commit `BoringSSL <https://boringssl.googlesource.com/boringssl/>`_ (commit
fa47b1d0f9d3d30601d7e5ed158d3055cbe6ff44); or OpenSSL >= 3.5.0 fa47b1d0f9d3d30601d7e5ed158d3055cbe6ff44); or OpenSSL >= 3.5.0
* `ngtcp2 <https://github.com/ngtcp2/ngtcp2>`_ >= 1.15.0 * `ngtcp2 <https://github.com/ngtcp2/ngtcp2>`_ >= 1.16.0
* `nghttp3 <https://github.com/ngtcp2/nghttp3>`_ >= 1.11.0 * `nghttp3 <https://github.com/ngtcp2/nghttp3>`_ >= 1.12.0
Use ``--enable-http3`` configure option to enable HTTP/3 feature for Use ``--enable-http3`` configure option to enable HTTP/3 feature for
h2load and nghttpx. h2load and nghttpx.

View File

@@ -532,7 +532,7 @@ fi
# ngtcp2 (for src) # ngtcp2 (for src)
have_libngtcp2=no have_libngtcp2=no
if test "x${request_libngtcp2}" != "xno"; then if test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 1.15.0], [have_libngtcp2=yes], PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 1.16.0], [have_libngtcp2=yes],
[have_libngtcp2=no]) [have_libngtcp2=no])
if test "x${have_libngtcp2}" = "xno"; then if test "x${have_libngtcp2}" = "xno"; then
AC_MSG_NOTICE($LIBNGTCP2_PKG_ERRORS) AC_MSG_NOTICE($LIBNGTCP2_PKG_ERRORS)
@@ -549,7 +549,7 @@ have_libngtcp2_crypto_wolfssl=no
if test "x${have_wolfssl_quic}" = "xyes" && if test "x${have_wolfssl_quic}" = "xyes" &&
test "x${request_libngtcp2}" != "xno"; then test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_WOLFSSL], PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_WOLFSSL],
[libngtcp2_crypto_wolfssl >= 1.15.0], [libngtcp2_crypto_wolfssl >= 1.16.0],
[have_libngtcp2_crypto_wolfssl=yes], [have_libngtcp2_crypto_wolfssl=yes],
[have_libngtcp2_crypto_wolfssl=no]) [have_libngtcp2_crypto_wolfssl=no])
if test "x${have_libngtcp2_crypto_wolfssl}" = "xno"; then if test "x${have_libngtcp2_crypto_wolfssl}" = "xno"; then
@@ -573,7 +573,7 @@ if test "x${have_ssl_provide_quic_data}" = "xyes" &&
test "x${have_boringssl_quic}" != "xyes" && test "x${have_boringssl_quic}" != "xyes" &&
test "x${request_libngtcp2}" != "xno"; then test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_QUICTLS], PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_QUICTLS],
[libngtcp2_crypto_quictls >= 1.15.0], [libngtcp2_crypto_quictls >= 1.16.0],
[have_libngtcp2_crypto_quictls=yes], [have_libngtcp2_crypto_quictls=yes],
[have_libngtcp2_crypto_quictls=no]) [have_libngtcp2_crypto_quictls=no])
if test "x${have_libngtcp2_crypto_quictls}" = "xno"; then if test "x${have_libngtcp2_crypto_quictls}" = "xno"; then
@@ -598,7 +598,7 @@ if test "x${have_ssl_provide_quic_data}" = "xyes" &&
test "x${have_libressl}" = "xyes" && test "x${have_libressl}" = "xyes" &&
test "x${request_libngtcp2}" != "xno"; then test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_LIBRESSL], PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_LIBRESSL],
[libngtcp2_crypto_libressl >= 1.15.0], [libngtcp2_crypto_libressl >= 1.16.0],
[have_libngtcp2_crypto_libressl=yes], [have_libngtcp2_crypto_libressl=yes],
[have_libngtcp2_crypto_libressl=no]) [have_libngtcp2_crypto_libressl=no])
if test "x${have_libngtcp2_crypto_libressl}" = "xno"; then if test "x${have_libngtcp2_crypto_libressl}" = "xno"; then
@@ -643,7 +643,7 @@ have_libngtcp2_crypto_ossl=no
if test "x${have_ossl_quic}" = "xyes" && if test "x${have_ossl_quic}" = "xyes" &&
test "x${request_libngtcp2}" != "xno"; then test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_OSSL], PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_OSSL],
[libngtcp2_crypto_ossl >= 1.15.0], [libngtcp2_crypto_ossl >= 1.16.0],
[have_libngtcp2_crypto_ossl=yes], [have_libngtcp2_crypto_ossl=yes],
[have_libngtcp2_crypto_ossl=no]) [have_libngtcp2_crypto_ossl=no])
if test "x${have_libngtcp2_crypto_ossl}" = "xno"; then if test "x${have_libngtcp2_crypto_ossl}" = "xno"; then
@@ -663,7 +663,7 @@ fi
# nghttp3 (for src) # nghttp3 (for src)
have_libnghttp3=no have_libnghttp3=no
if test "x${request_libnghttp3}" != "xno"; then if test "x${request_libnghttp3}" != "xno"; then
PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 1.11.0], [have_libnghttp3=yes], PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 1.12.0], [have_libnghttp3=yes],
[have_libnghttp3=no]) [have_libnghttp3=no])
if test "x${have_libnghttp3}" = "xno"; then if test "x${have_libnghttp3}" = "xno"; then
AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS) AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS)

View File

@@ -424,10 +424,11 @@ int Http3Session::init_conn() {
ssize_t Http3Session::read_stream(uint32_t flags, int64_t stream_id, ssize_t Http3Session::read_stream(uint32_t flags, int64_t stream_id,
const uint8_t *data, size_t datalen) { const uint8_t *data, size_t datalen) {
auto nconsumed = nghttp3_conn_read_stream( auto nconsumed = nghttp3_conn_read_stream2(
conn_, stream_id, data, datalen, flags & NGTCP2_STREAM_DATA_FLAG_FIN); conn_, stream_id, data, datalen, flags & NGTCP2_STREAM_DATA_FLAG_FIN,
ngtcp2_conn_get_timestamp(client_->quic.conn));
if (nconsumed < 0) { if (nconsumed < 0) {
std::cerr << "nghttp3_conn_read_stream: " std::cerr << "nghttp3_conn_read_stream2: "
<< nghttp3_strerror(static_cast<int>(nconsumed)) << std::endl; << nghttp3_strerror(static_cast<int>(nconsumed)) << std::endl;
ngtcp2_ccerr_set_application_error( ngtcp2_ccerr_set_application_error(
&client_->quic.last_error, &client_->quic.last_error,

View File

@@ -309,11 +309,11 @@ int Http3Upstream::recv_stream_data(uint32_t flags, int64_t stream_id,
std::span<const uint8_t> data) { std::span<const uint8_t> data) {
assert(httpconn_); assert(httpconn_);
auto nconsumed = auto nconsumed = nghttp3_conn_read_stream2(
nghttp3_conn_read_stream(httpconn_, stream_id, data.data(), data.size(), httpconn_, stream_id, data.data(), data.size(),
flags & NGTCP2_STREAM_DATA_FLAG_FIN); flags & NGTCP2_STREAM_DATA_FLAG_FIN, ngtcp2_conn_get_timestamp(conn_));
if (nconsumed < 0) { if (nconsumed < 0) {
ULOG(ERROR, this) << "nghttp3_conn_read_stream: " ULOG(ERROR, this) << "nghttp3_conn_read_stream2: "
<< nghttp3_strerror(static_cast<int>(nconsumed)); << nghttp3_strerror(static_cast<int>(nconsumed));
ngtcp2_ccerr_set_application_error( ngtcp2_ccerr_set_application_error(
&last_error_, &last_error_,