Compare commits

...

7 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
8a552631b4 Merge pull request #1667 from nghttp2/keep-hd-table-size
Fix decoder table size update
2022-01-11 20:53:08 +09:00
Tatsuhiro Tsujikawa
cff8106908 Merge pull request #1665 from c0bw3b/cleanup/spdy
Remove SPDY option for CMake
2022-01-11 20:14:37 +09:00
Tatsuhiro Tsujikawa
4eb49ac28e Merge pull request #1666 from Kludex/patch-1
Update nghttp2.pyx
2022-01-11 20:13:43 +09:00
Tatsuhiro Tsujikawa
deb390cf85 Fix decoder table size update
When applying new header table size acknowledged with SETTINGS ACK by
an encoder, change the header table size on a decoder only when it
strictly lowers the current maximum table size set by Dynamic Table
Size Update from the encoder or the default size 4096 if no Dynamic
Table Size Update is received.

Previously, the header table size on a decoder is always changed.  If
a maximum size in SETTINGS are increased (e.g., 4096 -> 8192), and
then decreased to the previous value, the decoder incorrectly requires
Dynamic Table Size Update from an encoder.
2022-01-11 19:50:45 +09:00
Tatsuhiro Tsujikawa
d91ae6987d Compile with the latest ngtcp2 2022-01-11 19:40:26 +09:00
Marcelo Trylesinski
8ddb2273b9 Update nghttp2.pyx 2022-01-01 19:18:14 +01:00
Renaud
e1446fd57a Remove SPDY option for CMake
SPDY feature removed in #1091 and release v1.29.0
2022-01-01 15:21:59 +01:00
8 changed files with 20 additions and 21 deletions

View File

@@ -23,8 +23,6 @@ option(WITH_LIBXML2 "Use libxml2"
${WITH_LIBXML2_DEFAULT})
option(WITH_JEMALLOC "Use jemalloc"
${WITH_JEMALLOC_DEFAULT})
option(WITH_SPDYLAY "Use spdylay"
${WITH_SPDYLAY_DEFAULT})
option(WITH_MRUBY "Use mruby")
option(WITH_NEVERBLEED "Use neverbleed")
option(WITH_LIBBPF "Use libbpf")

View File

@@ -1263,6 +1263,8 @@ int nghttp2_hd_inflate_change_table_size(
return NGHTTP2_ERR_INVALID_STATE;
}
inflater->settings_hd_table_bufsize_max = settings_max_dynamic_table_size;
/* It seems that encoder is not required to send dynamic table size
update if the table size is not changed after applying
SETTINGS_HEADER_TABLE_SIZE. RFC 7541 is ambiguous here, but this
@@ -1275,13 +1277,12 @@ int nghttp2_hd_inflate_change_table_size(
/* Remember minimum value, and validate that encoder sends the
value less than or equal to this. */
inflater->min_hd_table_bufsize_max = settings_max_dynamic_table_size;
inflater->ctx.hd_table_bufsize_max = settings_max_dynamic_table_size;
hd_context_shrink_table_size(&inflater->ctx, NULL);
}
inflater->settings_hd_table_bufsize_max = settings_max_dynamic_table_size;
inflater->ctx.hd_table_bufsize_max = settings_max_dynamic_table_size;
hd_context_shrink_table_size(&inflater->ctx, NULL);
return 0;
}

View File

@@ -1057,8 +1057,7 @@ if asyncio:
"""HTTP/2 request (stream) handler base class.
The class is used to handle the HTTP/2 stream. By default, it does
not nothing. It must be subclassed to handle each event callback
method.
nothing. It must be subclassed to handle each event callback method.
The first callback method invoked is on_headers(). It is called
when HEADERS frame, which includes request header fields, is

View File

@@ -535,12 +535,12 @@ void Client::quic_close_connection() {
case quic::ErrorType::Transport:
nwrite = ngtcp2_conn_write_connection_close(
quic.conn, &ps.path, nullptr, buf.data(), buf.size(),
quic.last_error.code, timestamp(worker->loop));
quic.last_error.code, nullptr, 0, timestamp(worker->loop));
break;
case quic::ErrorType::Application:
nwrite = ngtcp2_conn_write_application_close(
quic.conn, &ps.path, nullptr, buf.data(), buf.size(),
quic.last_error.code, timestamp(worker->loop));
quic.last_error.code, nullptr, 0, timestamp(worker->loop));
break;
default:
assert(0);

View File

@@ -1406,7 +1406,7 @@ void Http3Upstream::on_handler_delete() {
auto nwrite = ngtcp2_conn_write_connection_close(
conn_, &ps.path, &pi, conn_close_.data(), conn_close_.size(),
NGTCP2_NO_ERROR, quic_timestamp());
NGTCP2_NO_ERROR, nullptr, 0, quic_timestamp());
if (nwrite < 0) {
if (nwrite != NGTCP2_ERR_INVALID_STATE) {
ULOG(ERROR, this) << "ngtcp2_conn_write_connection_close: "
@@ -1764,7 +1764,7 @@ int Http3Upstream::handle_error() {
if (last_error_.type == quic::ErrorType::Transport) {
nwrite = ngtcp2_conn_write_connection_close(
conn_, &ps.path, &pi, conn_close_.data(), conn_close_.size(),
last_error_.code, ts);
last_error_.code, nullptr, 0, ts);
if (nwrite < 0) {
ULOG(ERROR, this) << "ngtcp2_conn_write_connection_close: "
<< ngtcp2_strerror(nwrite);
@@ -1773,7 +1773,7 @@ int Http3Upstream::handle_error() {
} else {
nwrite = ngtcp2_conn_write_application_close(
conn_, &ps.path, &pi, conn_close_.data(), conn_close_.size(),
last_error_.code, ts);
last_error_.code, nullptr, 0, ts);
if (nwrite < 0) {
ULOG(ERROR, this) << "ngtcp2_conn_write_application_close: "
<< ngtcp2_strerror(nwrite);

View File

@@ -615,7 +615,8 @@ int QUICConnectionHandler::send_connection_close(
std::array<uint8_t, NGTCP2_MAX_UDP_PAYLOAD_SIZE> buf;
auto nwrite = ngtcp2_crypto_write_connection_close(
buf.data(), buf.size(), version, &ini_scid, &ini_dcid, error_code);
buf.data(), buf.size(), version, &ini_scid, &ini_dcid, error_code,
nullptr, 0);
if (nwrite < 0) {
LOG(ERROR) << "ngtcp2_crypto_write_connection_close failed";
return -1;

View File

@@ -734,7 +734,7 @@ void test_nghttp2_hd_change_table_size(void) {
CU_ASSERT(4096 == deflater.ctx.hd_table_bufsize_max);
CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(4096 == inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max);
/* This will emit encoding context update with header table size 4096 */
@@ -830,8 +830,8 @@ void test_nghttp2_hd_change_table_size(void) {
CU_ASSERT(8000 == deflater.ctx.hd_table_bufsize_max);
CU_ASSERT(8000 == nghttp2_hd_deflate_get_max_dynamic_table_size(&deflater));
CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(8000 == nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater));
CU_ASSERT(4096 == inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(4096 == nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater));
CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max);
rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);
@@ -856,8 +856,8 @@ void test_nghttp2_hd_change_table_size(void) {
CU_ASSERT(8192 == deflater.ctx.hd_table_bufsize_max);
CU_ASSERT(8192 == nghttp2_hd_deflate_get_max_dynamic_table_size(&deflater));
CU_ASSERT(16383 == inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(16383 == nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater));
CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(8000 == nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater));
CU_ASSERT(16383 == inflater.settings_hd_table_bufsize_max);
rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2);

View File

@@ -5720,7 +5720,7 @@ void test_nghttp2_submit_settings(void) {
nghttp2_frame_settings_free(&ack_frame.settings, mem);
CU_ASSERT(16 * 1024 == session->local_settings.initial_window_size);
CU_ASSERT(1023 == session->hd_inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(111 == session->hd_inflater.ctx.hd_table_bufsize_max);
CU_ASSERT(111 == session->hd_inflater.min_hd_table_bufsize_max);
CU_ASSERT(50 == session->local_settings.max_concurrent_streams);