diff --git a/fuzz/fuzz_http3serverreq.cc b/fuzz/fuzz_http3serverreq.cc index 11d630eb..84c14ad1 100644 --- a/fuzz/fuzz_http3serverreq.cc +++ b/fuzz/fuzz_http3serverreq.cc @@ -345,6 +345,7 @@ void run_fuzzer(const uint8_t *data, size_t size, size_t step) { settings.enable_connect_protocol = fuzzed_data_provider.ConsumeIntegral(); settings.h3_datagram = fuzzed_data_provider.ConsumeIntegral(); + settings.initial_ts = 0; auto mem = *nghttp3_mem_default(); mem.user_data = &fuzzed_data_provider; @@ -355,6 +356,7 @@ void run_fuzzer(const uint8_t *data, size_t size, size_t step) { nghttp3_conn *conn; auto shutdown_started = false; auto server = fuzzed_data_provider.ConsumeBool(); + nghttp3_tstamp ts = 0; if (server) { auto rv = nghttp3_conn_server_new(&conn, &callbacks, &settings, &mem, @@ -418,11 +420,13 @@ void run_fuzzer(const uint8_t *data, size_t size, size_t step) { auto chunk = fuzzed_data_provider.ConsumeBytes(chunk_size); auto v = std::span{chunk}; auto fin = fuzzed_data_provider.ConsumeBool(); + ts = fuzzed_data_provider.ConsumeIntegralInRange( + ts, std::numeric_limits::max() - 1); for (; !v.empty();) { auto len = std::min(v.size(), step); - auto nread = nghttp3_conn_read_stream(conn, stream_id, v.data(), len, - v.size() == len && fin); + auto nread = nghttp3_conn_read_stream2(conn, stream_id, v.data(), len, + v.size() == len && fin, ts); if (nread < 0) { goto fin; } diff --git a/tests/nghttp3_conn_test.c b/tests/nghttp3_conn_test.c index 2fcf4447..c667ccfe 100644 --- a/tests/nghttp3_conn_test.c +++ b/tests/nghttp3_conn_test.c @@ -638,8 +638,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); memset(&ud, 0, sizeof(ud)); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_uint64(65536, ==, conn->remote.settings.max_field_section_size); @@ -664,7 +664,7 @@ void test_nghttp3_conn_read_control(void) { for (i = 0; i < nghttp3_buf_len(&buf); ++i) { nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos + i, 1, /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos + i, 1, /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); } @@ -692,8 +692,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); memset(&ud, 0, sizeof(ud)); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_size(1, ==, ud.recv_settings_cb.ncalled); @@ -725,8 +725,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_size(4097, ==, conn->remote.settings.qpack_max_dtable_capacity); @@ -759,8 +759,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_SETTINGS_ERROR, ==, nconsumed); @@ -788,8 +788,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_SETTINGS_ERROR, ==, nconsumed); @@ -814,8 +814,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_uint8(1, ==, conn->remote.settings.enable_connect_protocol); @@ -844,8 +844,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_SETTINGS_ERROR, ==, nconsumed); @@ -870,8 +870,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_uint8(1, ==, conn->remote.settings.h3_datagram); @@ -897,8 +897,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_uint8(0, ==, conn->remote.settings.h3_datagram); @@ -924,8 +924,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_SETTINGS_ERROR, ==, nconsumed); @@ -949,8 +949,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server(&conn); for (i = 0; i < nghttp3_buf_len(&buf); ++i) { - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos + i, 1, - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos + i, 1, + /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); } @@ -979,14 +979,14 @@ void test_nghttp3_conn_read_control(void) { for (i = 1; i < nghttp3_buf_len(&buf) - 1; ++i) { setup_default_server_with_options(&conn, opts); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, i, - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, i, + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)i, ==, nconsumed); nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos + i, nghttp3_buf_len(&buf) - i, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos + i, nghttp3_buf_len(&buf) - i, + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)(nghttp3_buf_len(&buf) - i), ==, nconsumed); @@ -1011,8 +1011,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server(&conn); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -1031,14 +1031,14 @@ void test_nghttp3_conn_read_control(void) { setup_default_server(&conn); nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf) - 1, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf) - 1, + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)(nghttp3_buf_len(&buf) - 1), ==, nconsumed); nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos + nghttp3_buf_len(&buf) - 1, 1, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos + nghttp3_buf_len(&buf) - 1, 1, + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -1056,8 +1056,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server(&conn); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_MISSING_SETTINGS, ==, nconsumed); @@ -1076,8 +1076,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server(&conn); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, nconsumed); @@ -1100,8 +1100,8 @@ void test_nghttp3_conn_read_control(void) { setup_default_server(&conn); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -1176,6 +1176,7 @@ void test_nghttp3_conn_write_control(void) { nghttp3_settings_default(&settings); settings.h3_datagram = 1; settings.enable_connect_protocol = 1; + settings.initial_ts = 0; conn_options_clear(&opts); opts.settings = &settings; @@ -1610,6 +1611,7 @@ void test_nghttp3_conn_http_request(void) { settings.qpack_max_dtable_capacity = 4096; settings.qpack_blocked_streams = 100; + settings.initial_ts = 0; clud.data.left = 2000; clud.data.step = 1200; @@ -1655,8 +1657,8 @@ void test_nghttp3_conn_http_request(void) { for (i = 0; i < (size_t)sveccnt; ++i) { sconsumed = - nghttp3_conn_read_stream(sv, stream_id, vec[i].base, vec[i].len, - fin && i == (size_t)sveccnt - 1); + nghttp3_conn_read_stream2(sv, stream_id, vec[i].base, vec[i].len, + fin && i == (size_t)sveccnt - 1, 0); assert_ptrdiff(0, <=, sconsumed); nread += vec[i].len; @@ -1696,8 +1698,8 @@ void test_nghttp3_conn_http_request(void) { for (i = 0; i < (size_t)sveccnt; ++i) { sconsumed = - nghttp3_conn_read_stream(cl, stream_id, vec[i].base, vec[i].len, - fin && i == (size_t)sveccnt - 1); + nghttp3_conn_read_stream2(cl, stream_id, vec[i].base, vec[i].len, + fin && i == (size_t)sveccnt - 1, 0); assert_ptrdiff(0, <=, sconsumed); nread += vec[i].len; @@ -1731,6 +1733,7 @@ static void check_http_header(const nghttp3_nv *nva, size_t nvlen, int request, nghttp3_settings_default(&settings); settings.enable_connect_protocol = 1; + settings.initial_ts = 0; nghttp3_buf_wrap_init(&buf, rawbuf, sizeof(rawbuf)); nghttp3_qpack_encoder_init(&qenc, 0, NGHTTP3_TEST_MAP_SEED, mem); @@ -1753,8 +1756,8 @@ static void check_http_header(const nghttp3_nv *nva, size_t nvlen, int request, stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; } - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); if (want_lib_error) { assert_ptrdiff(want_lib_error, ==, sconsumed); @@ -2342,8 +2345,8 @@ void test_nghttp3_conn_http_content_length(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_int64(9000000000LL, ==, stream->rx.http.content_length); @@ -2365,8 +2368,8 @@ void test_nghttp3_conn_http_content_length(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -2413,8 +2416,8 @@ void test_nghttp3_conn_http_content_length_mismatch(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING, ==, sconsumed); @@ -2435,8 +2438,8 @@ void test_nghttp3_conn_http_content_length_mismatch(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -2465,8 +2468,8 @@ void test_nghttp3_conn_http_content_length_mismatch(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING, ==, sconsumed); @@ -2489,8 +2492,8 @@ void test_nghttp3_conn_http_content_length_mismatch(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING, ==, sconsumed); @@ -2512,8 +2515,8 @@ void test_nghttp3_conn_http_content_length_mismatch(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -2543,8 +2546,8 @@ void test_nghttp3_conn_http_content_length_mismatch(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING, ==, sconsumed); @@ -2586,8 +2589,8 @@ void test_nghttp3_conn_http_non_final_response(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2615,8 +2618,8 @@ void test_nghttp3_conn_http_non_final_response(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -2645,8 +2648,8 @@ void test_nghttp3_conn_http_non_final_response(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_HEADER, ==, sconsumed); @@ -2703,8 +2706,8 @@ void test_nghttp3_conn_http_trailers(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -2731,8 +2734,8 @@ void test_nghttp3_conn_http_trailers(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_HEADER, ==, sconsumed); @@ -2760,8 +2763,8 @@ void test_nghttp3_conn_http_trailers(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2791,8 +2794,8 @@ void test_nghttp3_conn_http_trailers(void) { nghttp3_http_record_request_method(stream, connect_reqnv, nghttp3_arraylen(connect_reqnv)); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2823,8 +2826,8 @@ void test_nghttp3_conn_http_trailers(void) { nghttp3_http_record_request_method(stream, connect_reqnv, nghttp3_arraylen(connect_reqnv)); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2850,8 +2853,8 @@ void test_nghttp3_conn_http_trailers(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -2872,8 +2875,8 @@ void test_nghttp3_conn_http_trailers(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_HEADER, ==, sconsumed); @@ -2900,8 +2903,8 @@ void test_nghttp3_conn_http_trailers(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2927,8 +2930,8 @@ void test_nghttp3_conn_http_trailers(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2955,8 +2958,8 @@ void test_nghttp3_conn_http_trailers(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -2990,8 +2993,8 @@ void test_nghttp3_conn_http_trailers(void) { setup_default_server_with_options(&conn, opts); ud.recv_trailer_cb.ncalled = 0; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_size(0, ==, ud.recv_trailer_cb.ncalled); @@ -3030,8 +3033,8 @@ void test_nghttp3_conn_http_trailers(void) { stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; ud.recv_trailer_cb.ncalled = 0; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_size(0, ==, ud.recv_trailer_cb.ncalled); @@ -3080,8 +3083,8 @@ void test_nghttp3_conn_http_ignore_content_length(void) { nghttp3_conn_create_stream(conn, &stream, 0); stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_int64(0, ==, stream->rx.http.content_length); @@ -3106,8 +3109,8 @@ void test_nghttp3_conn_http_ignore_content_length(void) { setup_default_server(&conn); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -3137,8 +3140,8 @@ void test_nghttp3_conn_http_ignore_content_length(void) { stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_INITIAL; stream->rx.http.flags |= NGHTTP3_HTTP_FLAG_METH_CONNECT; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_int64(-1, ==, stream->rx.http.content_length); @@ -3192,8 +3195,8 @@ void test_nghttp3_conn_http_record_request_method(void) { nghttp3_http_record_request_method(stream, connect_reqnv, nghttp3_arraylen(connect_reqnv)); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_int64(-1, ==, stream->rx.http.content_length); @@ -3218,8 +3221,8 @@ void test_nghttp3_conn_http_record_request_method(void) { nghttp3_http_record_request_method(stream, head_reqnv, nghttp3_arraylen(head_reqnv)); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); assert_int64(0, ==, stream->rx.http.content_length); @@ -3259,6 +3262,7 @@ void test_nghttp3_conn_http_error(void) { nghttp3_settings_default(&settings); settings.qpack_max_dtable_capacity = 4096; settings.qpack_blocked_streams = 100; + settings.initial_ts = 0; /* duplicated :scheme */ nghttp3_buf_wrap_init(&buf, rawbuf, sizeof(rawbuf)); @@ -3277,8 +3281,8 @@ void test_nghttp3_conn_http_error(void) { setup_default_server_with_options(&conn, opts); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_HEADER, ==, sconsumed); @@ -3302,8 +3306,8 @@ void test_nghttp3_conn_http_error(void) { setup_default_server_with_options(&conn, opts); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_HEADER, ==, sconsumed); @@ -3334,8 +3338,8 @@ void test_nghttp3_conn_http_error(void) { setup_default_server_with_options(&conn, opts); nghttp3_conn_set_max_client_streams_bidi(conn, 1); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(0, <, sconsumed); assert_ptrdiff(sconsumed, !=, (nghttp3_ssize)nghttp3_buf_len(&buf)); @@ -3347,13 +3351,13 @@ void test_nghttp3_conn_http_error(void) { nghttp3_buf_reset(&buf); buf.last = nghttp3_put_varint(buf.last, NGHTTP3_STREAM_TYPE_QPACK_ENCODER); - sconsumed = nghttp3_conn_read_stream(conn, 6, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 6, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); - sconsumed = nghttp3_conn_read_stream(conn, 6, ebuf.pos, - nghttp3_buf_len(&ebuf), /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2( + conn, 6, ebuf.pos, nghttp3_buf_len(&ebuf), /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_HEADER, ==, sconsumed); @@ -3380,6 +3384,7 @@ void test_nghttp3_conn_qpack_blocked_stream(void) { nghttp3_settings_default(&settings); settings.qpack_max_dtable_capacity = 4096; settings.qpack_blocked_streams = 100; + settings.initial_ts = 0; /* Closing QUIC stream deletes a stream that is blocked by QPACK */ nghttp3_buf_init(&ebuf); @@ -3409,8 +3414,8 @@ void test_nghttp3_conn_qpack_blocked_stream(void) { nghttp3_write_frame_qpack_dyn(&buf, &ebuf, &qenc, 0, &fr); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(0, <, sconsumed); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), !=, sconsumed); @@ -3420,8 +3425,8 @@ void test_nghttp3_conn_qpack_blocked_stream(void) { nghttp3_buf_reset(&buf); nghttp3_write_frame_data(&buf, 1111); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff(0, ==, sconsumed); @@ -3476,9 +3481,9 @@ void test_nghttp3_conn_qpack_blocked_stream(void) { /* Write garbage to continue to read stream */ buf.pos[4] = 0xff; - sconsumed = nghttp3_conn_read_stream( + sconsumed = nghttp3_conn_read_stream2( conn, 0, buf.pos, 5 /* Frame header + Header Block Prefix */, - /* fin = */ 1); + /* fin = */ 1, 0); assert_ptrdiff(0, <, sconsumed); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), !=, sconsumed); @@ -3717,7 +3722,7 @@ void test_nghttp3_conn_recv_uni(void) { /* 0 length unidirectional stream must be ignored */ setup_default_client(&conn); - nread = nghttp3_conn_read_stream(conn, 3, NULL, 0, /* fin = */ 1); + nread = nghttp3_conn_read_stream2(conn, 3, NULL, 0, /* fin = */ 1, 0); assert_ptrdiff(0, ==, nread); assert_null(nghttp3_conn_find_stream(conn, 3)); @@ -3728,12 +3733,12 @@ void test_nghttp3_conn_recv_uni(void) { and then get 0 length with fin. */ setup_default_client(&conn); - nread = nghttp3_conn_read_stream(conn, 3, NULL, 0, /* fin = */ 0); + nread = nghttp3_conn_read_stream2(conn, 3, NULL, 0, /* fin = */ 0, 0); assert_ptrdiff(0, ==, nread); assert_not_null(nghttp3_conn_find_stream(conn, 3)); - nread = nghttp3_conn_read_stream(conn, 3, NULL, 0, /* fin = */ 1); + nread = nghttp3_conn_read_stream2(conn, 3, NULL, 0, /* fin = */ 1, 0); assert_ptrdiff(0, ==, nread); assert_null(nghttp3_conn_find_stream(conn, 3)); @@ -3745,12 +3750,12 @@ void test_nghttp3_conn_recv_uni(void) { /* 4 bytes integer */ buf[0] = 0xc0; - nread = nghttp3_conn_read_stream(conn, 3, buf, 1, /* fin = */ 0); + nread = nghttp3_conn_read_stream2(conn, 3, buf, 1, /* fin = */ 0, 0); assert_ptrdiff(1, ==, nread); assert_not_null(nghttp3_conn_find_stream(conn, 3)); - nread = nghttp3_conn_read_stream(conn, 3, NULL, 0, /* fin = */ 1); + nread = nghttp3_conn_read_stream2(conn, 3, NULL, 0, /* fin = */ 1, 0); assert_ptrdiff(NGHTTP3_ERR_H3_GENERAL_PROTOCOL_ERROR, ==, nread); @@ -3760,7 +3765,7 @@ void test_nghttp3_conn_recv_uni(void) { setup_default_client(&conn); buf[0] = NGHTTP3_STREAM_TYPE_PUSH; - nread = nghttp3_conn_read_stream(conn, 3, buf, 1, /* fin = */ 0); + nread = nghttp3_conn_read_stream2(conn, 3, buf, 1, /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_STREAM_CREATION_ERROR, ==, nread); @@ -3847,8 +3852,8 @@ void test_nghttp3_conn_recv_goaway(void) { ud.shutdown_cb.ncalled = 0; ud.shutdown_cb.id = 0; - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_true(conn->flags & NGHTTP3_CONN_FLAG_GOAWAY_RECVED); @@ -3891,8 +3896,8 @@ void test_nghttp3_conn_recv_goaway(void) { ud.shutdown_cb.ncalled = 0; ud.shutdown_cb.id = 0; - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_ID_ERROR, ==, nconsumed); assert_true(conn->flags & NGHTTP3_CONN_FLAG_GOAWAY_RECVED); @@ -3924,8 +3929,8 @@ void test_nghttp3_conn_recv_goaway(void) { ud.shutdown_cb.ncalled = 0; ud.shutdown_cb.id = 0; - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_true(conn->flags & NGHTTP3_CONN_FLAG_GOAWAY_RECVED); @@ -3949,8 +3954,8 @@ void test_nghttp3_conn_recv_goaway(void) { buf.last = nghttp3_put_varint(buf.last, NGHTTP3_FRAME_GOAWAY); buf.last = nghttp3_put_varint(buf.last, 0); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -3972,8 +3977,8 @@ void test_nghttp3_conn_recv_goaway(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_ID_ERROR, ==, nconsumed); @@ -3996,8 +4001,8 @@ void test_nghttp3_conn_recv_goaway(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); for (i = 0; i < nghttp3_buf_len(&buf); ++i) { - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos + i, 1, - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos + i, 1, + /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); } @@ -4086,8 +4091,8 @@ void test_nghttp3_conn_shutdown_server(void) { nghttp3_write_frame_qpack(&buf, &qenc, 4, &fr); - nconsumed = nghttp3_conn_read_stream(conn, 4, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 4, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_int64(4, ==, conn->rx.max_stream_id_bidi); @@ -4113,8 +4118,8 @@ void test_nghttp3_conn_shutdown_server(void) { nghttp3_write_frame_qpack(&buf, &qenc, 8, &fr); memset(&ud, 0, sizeof(ud)); - nconsumed = nghttp3_conn_read_stream(conn, 8, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 8, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_int64(8, ==, conn->rx.max_stream_id_bidi); @@ -4220,8 +4225,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4240,8 +4245,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - nconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + nconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4273,8 +4278,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4293,8 +4298,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - nconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + nconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4329,8 +4334,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_true(stream->flags & NGHTTP3_STREAM_FLAG_PRIORITY_UPDATE_RECVED); @@ -4358,8 +4363,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_ID_ERROR, ==, nconsumed); @@ -4391,16 +4396,16 @@ void test_nghttp3_conn_priority_update(void) { /* Make sure boundary check works when frame is fragmented. */ nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf) - 10, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf) - 10, + /* fin = */ 0, 0); stream = nghttp3_conn_find_stream(conn, 2); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf) - 10, ==, nconsumed); assert_int(NGHTTP3_CTRL_STREAM_STATE_PRIORITY_UPDATE, ==, stream->rstate.state); - nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos + nconsumed, 10, /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos + nconsumed, 10, + /* fin = */ 0, 0); assert_ptrdiff(10, ==, nconsumed); assert_int(NGHTTP3_CTRL_STREAM_STATE_FRAME_TYPE, ==, stream->rstate.state); @@ -4430,8 +4435,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4463,8 +4468,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4497,14 +4502,14 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf) - 1, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf) - 1, + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)(nghttp3_buf_len(&buf) - 1), ==, nconsumed); nconsumed = - nghttp3_conn_read_stream(conn, 2, buf.pos + nghttp3_buf_len(&buf) - 1, 1, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 2, buf.pos + nghttp3_buf_len(&buf) - 1, 1, + /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); @@ -4535,8 +4540,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_GENERAL_PROTOCOL_ERROR, ==, nconsumed); @@ -4563,8 +4568,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, nconsumed); @@ -4584,8 +4589,8 @@ void test_nghttp3_conn_priority_update(void) { buf.last = nghttp3_put_varint(buf.last, NGHTTP3_FRAME_PRIORITY_UPDATE); buf.last = nghttp3_put_varint(buf.last, 0); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -4611,8 +4616,8 @@ void test_nghttp3_conn_priority_update(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); for (i = 0; i < nghttp3_buf_len(&buf); ++i) { - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos + i, 1, - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos + i, 1, + /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); } @@ -4711,8 +4716,8 @@ void test_nghttp3_conn_request_priority(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4724,8 +4729,8 @@ void test_nghttp3_conn_request_priority(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - nconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + nconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4751,8 +4756,8 @@ void test_nghttp3_conn_request_priority(void) { nghttp3_write_frame(&buf, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4764,8 +4769,8 @@ void test_nghttp3_conn_request_priority(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - nconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + nconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -4883,6 +4888,7 @@ void test_nghttp3_conn_shutdown_stream_read(void) { nghttp3_settings_default(&settings); settings.qpack_max_dtable_capacity = 4096; settings.qpack_blocked_streams = 100; + settings.initial_ts = 0; /* Shutting down read-side stream when a stream is blocked by QPACK dependency. */ @@ -4918,8 +4924,8 @@ void test_nghttp3_conn_shutdown_stream_read(void) { ud.deferred_consume_cb.consumed_total = 0; consumed_total = 0; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(0, <, sconsumed); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), !=, sconsumed); @@ -4938,8 +4944,8 @@ void test_nghttp3_conn_shutdown_stream_read(void) { ++indatalen; - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff(1, ==, sconsumed); @@ -4948,13 +4954,13 @@ void test_nghttp3_conn_shutdown_stream_read(void) { nghttp3_buf_reset(&buf); buf.last = nghttp3_put_varint(buf.last, NGHTTP3_STREAM_TYPE_QPACK_ENCODER); - sconsumed = nghttp3_conn_read_stream(conn, 7, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 7, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); - sconsumed = nghttp3_conn_read_stream(conn, 7, ebuf.pos, - nghttp3_buf_len(&ebuf), /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2( + conn, 7, ebuf.pos, nghttp3_buf_len(&ebuf), /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&ebuf), ==, sconsumed); /* Make sure that Section Acknowledgement is not written. */ @@ -5055,19 +5061,21 @@ void test_nghttp3_conn_get_frame_payload_left(void) { assert_size(18, ==, nghttp3_buf_len(&buf)); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, 3, /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, 3, /* fin = */ 0, 0); assert_ptrdiff(3, ==, nconsumed); assert_uint64(nghttp3_buf_len(&buf) - 3, ==, nghttp3_conn_get_frame_payload_left(conn, 2)); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos + 3, 14, /* fin = */ 0); + nconsumed = + nghttp3_conn_read_stream2(conn, 2, buf.pos + 3, 14, /* fin = */ 0, 0); assert_ptrdiff(14, ==, nconsumed); assert_uint64(nghttp3_buf_len(&buf) - 17, ==, nghttp3_conn_get_frame_payload_left(conn, 2)); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos + 17, 1, /* fin = */ 0); + nconsumed = + nghttp3_conn_read_stream2(conn, 2, buf.pos + 17, 1, /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); assert_uint64(0, ==, nghttp3_conn_get_frame_payload_left(conn, 2)); @@ -5088,13 +5096,13 @@ void test_nghttp3_conn_get_frame_payload_left(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, (nghttp3_frame *)&fr); - nconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, 1, /* fin = 0 */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, 1, /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); assert_uint64(0, ==, nghttp3_conn_get_frame_payload_left(conn, 0)); nconsumed = - nghttp3_conn_read_stream(conn, 0, buf.pos + 1, 1, /* fin = 0 */ 0); + nghttp3_conn_read_stream2(conn, 0, buf.pos + 1, 1, /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); assert_uint64(nghttp3_buf_len(&buf) - 2, ==, @@ -5289,8 +5297,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_data(&buf, 7); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -5309,13 +5317,13 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); sconsumed = - nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf) - 1, - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf) - 1, + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf) - 1, ==, sconsumed); - sconsumed = nghttp3_conn_read_stream(conn, 0, NULL, 0, - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, NULL, 0, + /* fin = */ 1, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, sconsumed); @@ -5347,8 +5355,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -5359,8 +5367,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_buf_reset(&buf); nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -5385,8 +5393,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); nghttp3_write_frame_data(&buf, 11); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf) - 11, ==, sconsumed); @@ -5397,8 +5405,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_buf_reset(&buf); nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -5439,8 +5447,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -5475,8 +5483,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_data(&buf, 119); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, sconsumed); @@ -5512,8 +5520,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); nghttp3_write_frame_data(&buf, 73); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf) - 73, ==, sconsumed); @@ -5524,8 +5532,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_buf_reset(&buf); nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -5545,8 +5553,8 @@ void test_nghttp3_conn_rx_http_state(void) { buf.last = nghttp3_frame_write_hd(buf.last, fr.type, 0); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING, ==, sconsumed); @@ -5565,8 +5573,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_write_frame_qpack(&buf, &qenc, 0, &fr); nghttp3_write_frame_data(&buf, 999); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf) - 999, ==, sconsumed); @@ -5575,8 +5583,8 @@ void test_nghttp3_conn_rx_http_state(void) { nghttp3_buf_reset(&buf); buf.last = nghttp3_frame_write_hd(buf.last, fr.type, 0); - sconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 1); + sconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 1, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, sconsumed); @@ -5618,8 +5626,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, (int64_t)nghttp3_put_varintlen(64)); buf.last = nghttp3_put_varint(buf.last, 64); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -5642,8 +5650,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, 64); for (i = 0; i < nghttp3_buf_len(&buf); ++i) { - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos + i, 1, - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos + i, 1, + /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); } @@ -5670,8 +5678,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, (int64_t)nghttp3_put_varintlen(63)); buf.last = nghttp3_put_varint(buf.last, 63); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -5688,8 +5696,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, NGHTTP3_FRAME_MAX_PUSH_ID); buf.last = nghttp3_put_varint(buf.last, 0); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -5707,8 +5715,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, (int64_t)nghttp3_put_varintlen(64)); buf.last = nghttp3_put_varint(buf.last, 64); - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, nconsumed); @@ -5726,8 +5734,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, (int64_t)nghttp3_put_varintlen(0)); buf.last = nghttp3_put_varint(buf.last, 0); - nconsumed = nghttp3_conn_read_stream(conn, 2, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 2, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, nconsumed); @@ -5752,8 +5760,8 @@ void test_nghttp3_conn_push(void) { buf.last = nghttp3_put_varint(buf.last, NGHTTP3_FRAME_PUSH_PROMISE); buf.last = nghttp3_put_varint(buf.last, (int64_t)nghttp3_put_varintlen(107)); - nconsumed = nghttp3_conn_read_stream(conn, 0, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 0, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_UNEXPECTED, ==, nconsumed); @@ -5850,8 +5858,8 @@ void test_nghttp3_conn_recv_origin(void) { nghttp3_write_frame(&buf, &fr); nconsumed = - nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_size(ud.recv_origin_cb.origin_listlen, ==, ud.recv_origin_cb.offset); @@ -5873,8 +5881,8 @@ void test_nghttp3_conn_recv_origin(void) { nghttp3_write_frame(&buf, &fr); nconsumed = - nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -5899,8 +5907,8 @@ void test_nghttp3_conn_recv_origin(void) { ud.recv_origin_cb.offset = 0; for (i = 0; i < nghttp3_buf_len(&buf); ++i) { - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos + i, 1, - /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2(conn, 3, buf.pos + i, 1, + /* fin = */ 0, 0); assert_ptrdiff(1, ==, nconsumed); } @@ -5943,8 +5951,8 @@ void test_nghttp3_conn_recv_origin(void) { ud.recv_origin_cb.offset = 0; - nconsumed = nghttp3_conn_read_stream( - conn, 3, buf.pos, nghttp3_buf_len(&buf), /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2( + conn, 3, buf.pos, nghttp3_buf_len(&buf), /* fin = */ 0, 0); if (i == 0 || i == 2 + 0x13 || i == 2 + 0x13 + 2 + 0x17 || i == strsize(origin_list)) { @@ -5977,8 +5985,8 @@ void test_nghttp3_conn_recv_origin(void) { ud.recv_origin_cb.origin_listlen = nghttp3_arraylen(expected); ud.recv_origin_cb.offset = 0; - nconsumed = nghttp3_conn_read_stream( - conn, 3, buf.pos, /* frame header = */ 3 + 2 + 0x13, /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2( + conn, 3, buf.pos, /* frame header = */ 3 + 2 + 0x13, /* fin = */ 0, 0); assert_ptrdiff(3 + 2 + 0x13, ==, nconsumed); @@ -5989,8 +5997,8 @@ void test_nghttp3_conn_recv_origin(void) { buf.pos += nconsumed; - nconsumed = nghttp3_conn_read_stream(conn, 3, buf.pos, - nghttp3_buf_len(&buf), /* fin = */ 0); + nconsumed = nghttp3_conn_read_stream2( + conn, 3, buf.pos, nghttp3_buf_len(&buf), /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_size(ud.recv_origin_cb.origin_listlen, ==, ud.recv_origin_cb.offset); @@ -6020,8 +6028,8 @@ void test_nghttp3_conn_recv_origin(void) { ud.recv_origin_cb.offset = 0; nconsumed = - nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff(NGHTTP3_ERR_H3_FRAME_ERROR, ==, nconsumed); @@ -6038,8 +6046,8 @@ void test_nghttp3_conn_recv_origin(void) { nghttp3_write_frame(&buf, &fr); nconsumed = - nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); @@ -6080,8 +6088,8 @@ void test_nghttp3_conn_recv_origin(void) { ud.recv_origin_cb.offset = 0; nconsumed = - nghttp3_conn_read_stream(conn, 3, buf.pos, nghttp3_buf_len(&buf), - /* fin = */ 0); + nghttp3_conn_read_stream2(conn, 3, buf.pos, nghttp3_buf_len(&buf), + /* fin = */ 0, 0); assert_ptrdiff((nghttp3_ssize)nghttp3_buf_len(&buf), ==, nconsumed); assert_size(ud.recv_origin_cb.origin_listlen, ==, ud.recv_origin_cb.offset); @@ -6153,6 +6161,7 @@ void test_nghttp3_conn_write_origin(void) { origin_list.base = (uint8_t *)origins; origin_list.len = strsize(origins); settings.origin_list = &origin_list; + settings.initial_ts = 0; conn_options_clear(&opts); opts.settings = &settings; @@ -6187,6 +6196,7 @@ void test_nghttp3_conn_write_origin(void) { origin_list.base = NULL; origin_list.len = 0; settings.origin_list = &origin_list; + settings.initial_ts = 0; conn_options_clear(&opts); opts.settings = &settings; @@ -6222,6 +6232,7 @@ void test_nghttp3_conn_write_origin(void) { origin_list.base = long_origin; origin_list.len = sizeof(long_origin); settings.origin_list = &origin_list; + settings.initial_ts = 0; conn_options_clear(&opts); opts.settings = &settings;