Projects
home:fstrba
nghttp3
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
nghttp3.spec
Changed
@@ -28,6 +28,8 @@ Source1: https://github.com/ngtcp2/nghttp3/releases/download/v%{version}/nghttp3-%{version}.tar.xz.asc Source2: nghttp3.keyring Source3: baselibs.conf +# https://github.com/lexiforest/curl-impersonate/raw/refs/tags/v2.1.1/patches/nghttp3.patch +Patch0: curl-impersonate.patch BuildRequires: gcc-c++ BuildRequires: pkgconfig BuildRequires: python-rpm-macros
View file
curl-impersonate.patch
Added
@@ -0,0 +1,335 @@ +--- nghttp3-1.18.0.orig/lib/includes/nghttp3/nghttp3.h 2026-08-24 15:05:59.316118732 +0200 ++++ nghttp3-1.18.0/lib/includes/nghttp3/nghttp3.h 2026-08-24 15:06:12.559173850 +0200 +@@ -1801,6 +1801,53 @@ + #define NGHTTP3_SETTINGS_VERSION NGHTTP3_SETTINGS_V4 + + /** ++ * @macro ++ * ++ * :macro:`NGHTTP3_SETTINGS_ID_MAX_FIELD_SECTION_SIZE` is the HTTP/3 ++ * SETTINGS identifier for MAX_FIELD_SECTION_SIZE. ++ */ ++#define NGHTTP3_SETTINGS_ID_MAX_FIELD_SECTION_SIZE 0x06 ++/** ++ * @macro ++ * ++ * :macro:`NGHTTP3_SETTINGS_ID_QPACK_MAX_TABLE_CAPACITY` is the ++ * HTTP/3 SETTINGS identifier for QPACK_MAX_TABLE_CAPACITY. ++ */ ++#define NGHTTP3_SETTINGS_ID_QPACK_MAX_TABLE_CAPACITY 0x01 ++/** ++ * @macro ++ * ++ * :macro:`NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS` is the HTTP/3 ++ * SETTINGS identifier for QPACK_BLOCKED_STREAMS. ++ */ ++#define NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS 0x07 ++/** ++ * @macro ++ * ++ * :macro:`NGHTTP3_SETTINGS_ID_ENABLE_CONNECT_PROTOCOL` is the HTTP/3 ++ * SETTINGS identifier for ENABLE_CONNECT_PROTOCOL. ++ */ ++#define NGHTTP3_SETTINGS_ID_ENABLE_CONNECT_PROTOCOL 0x08 ++/** ++ * @macro ++ * ++ * :macro:`NGHTTP3_SETTINGS_ID_H3_DATAGRAM` is the HTTP/3 SETTINGS ++ * identifier for H3_DATAGRAM. ++ */ ++#define NGHTTP3_SETTINGS_ID_H3_DATAGRAM 0x33 ++ ++/** ++ * @struct ++ * ++ * :type:`nghttp3_settings_entry` is an HTTP/3 SETTINGS identifier and ++ * value pair. ++ */ ++typedef struct nghttp3_settings_entry { ++ uint64_t id; ++ uint64_t value; ++} nghttp3_settings_entry; ++ ++/** + * @struct + * + * :type:`nghttp3_settings` defines HTTP/3 settings. +@@ -2579,6 +2626,33 @@ + + /** + * @function ++ * ++ * `nghttp3_conn_submit_settings` submits SETTINGS entries to be sent ++ * on the control stream in the same order as |iv|. The entries are ++ * copied by this function, and |iv| does not have to be kept after ++ * this function returns. |iv| may be NULL if |niv| is 0. |flags| ++ * is currently ignored and should be 0. ++ * ++ * This function must be called before ++ * `nghttp3_conn_bind_control_stream`. ++ * ++ * This function returns 0 if it succeeds, or one of the following ++ * negative error codes: ++ * ++ * :macro:`NGHTTP3_ERR_INVALID_STATE` ++ * Control stream has already been bound. ++ * :macro:`NGHTTP3_ERR_INVALID_ARGUMENT` ++ * |iv| is NULL but |niv| is not 0. ++ * :macro:`NGHTTP3_ERR_NOMEM` ++ * Out of memory. ++ */ ++NGHTTP3_EXTERN int nghttp3_conn_submit_settings(nghttp3_conn *conn, ++ uint8_t flags, ++ const nghttp3_settings_entry *iv, ++ size_t niv); ++ ++/** ++ * @function + * + * .. warning:: + * +--- nghttp3-1.18.0.orig/lib/nghttp3_conn.c 2026-08-24 15:05:59.315038119 +0200 ++++ nghttp3-1.18.0/lib/nghttp3_conn.c 2026-08-24 15:06:12.559851438 +0200 +@@ -438,6 +438,7 @@ + nghttp3_objalloc_free(&conn->stream_objalloc); + nghttp3_objalloc_free(&conn->out_chunk_objalloc); + ++ nghttp3_mem_free(conn->mem, conn->local.settings_iv); + nghttp3_mem_free(conn->mem, conn->rx.originbuf); + + nghttp3_mem_free(conn->mem, conn); +@@ -2194,6 +2195,13 @@ + .type = NGHTTP3_FRAME_SETTINGS, + .local_settings = &conn->local.settings, + }; ++ if (conn->local.settings_submitted) { ++ fr->settings = (nghttp3_frame_settings){ ++ .type = NGHTTP3_FRAME_SETTINGS, ++ .niv = conn->local.settings_niv, ++ .iv = conn->local.settings_iv, ++ }; ++ } + + if (conn->local.settings.origin_list) { + assert(conn->server); +@@ -2211,6 +2219,41 @@ + + return 0; + } ++ ++int nghttp3_conn_submit_settings(nghttp3_conn *conn, uint8_t flags, ++ const nghttp3_settings_entry *iv, ++ size_t niv) { ++ nghttp3_settings_entry *niv_copy = NULL; ++ (void)flags; ++ ++ if (conn->tx.ctrl) { ++ return NGHTTP3_ERR_INVALID_STATE; ++ } ++ ++ if (niv && iv == NULL) { ++ return NGHTTP3_ERR_INVALID_ARGUMENT; ++ } ++ ++ if (niv > SIZE_MAX / sizeof(*niv_copy)) { ++ return NGHTTP3_ERR_NOMEM; ++ } ++ ++ if (niv) { ++ niv_copy = nghttp3_mem_malloc(conn->mem, sizeof(*niv_copy) * niv); ++ if (niv_copy == NULL) { ++ return NGHTTP3_ERR_NOMEM; ++ } ++ ++ memcpy(niv_copy, iv, sizeof(*niv_copy) * niv); ++ } ++ ++ nghttp3_mem_free(conn->mem, conn->local.settings_iv); ++ conn->local.settings_iv = niv_copy; ++ conn->local.settings_niv = niv; ++ conn->local.settings_submitted = 1; ++ ++ return 0; ++} + + int nghttp3_conn_bind_qpack_streams(nghttp3_conn *conn, int64_t qenc_stream_id, + int64_t qdec_stream_id) { +--- nghttp3-1.18.0.orig/lib/nghttp3_conn.h 2026-08-24 15:05:59.315118083 +0200 ++++ nghttp3-1.18.0/lib/nghttp3_conn.h 2026-08-24 15:06:12.560360625 +0200 +@@ -100,6 +100,11 @@ + object is initialized as server. settings.origin_list may + point to the address of this field. */ + nghttp3_vec origin_list; ++ /* settings_iv points to a copied settings array passed to ++ nghttp3_conn_submit_settings(). */ ++ nghttp3_settings_entry *settings_iv; ++ size_t settings_niv; ++ uint8_t settings_submitted; + nghttp3_settings settings; + struct { + /* max_pushes is the number of push IDs that local endpoint can +--- nghttp3-1.18.0.orig/lib/nghttp3_frame.h 2026-08-24 15:05:59.313909955 +0200 ++++ nghttp3-1.18.0/lib/nghttp3_frame.h 2026-08-24 15:07:35.315667873 +0200 +@@ -71,22 +71,11 @@ + size_t nvlen; + } nghttp3_frame_headers; + +-#define NGHTTP3_SETTINGS_ID_MAX_FIELD_SECTION_SIZE 0x06U +-#define NGHTTP3_SETTINGS_ID_QPACK_MAX_TABLE_CAPACITY 0x01U +-#define NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS 0x07U +-#define NGHTTP3_SETTINGS_ID_ENABLE_CONNECT_PROTOCOL 0x08U +-#define NGHTTP3_SETTINGS_ID_H3_DATAGRAM 0x33U +- + #define NGHTTP3_H2_SETTINGS_ID_ENABLE_PUSH 0x2U + #define NGHTTP3_H2_SETTINGS_ID_MAX_CONCURRENT_STREAMS 0x3U + #define NGHTTP3_H2_SETTINGS_ID_INITIAL_WINDOW_SIZE 0x4U + #define NGHTTP3_H2_SETTINGS_ID_MAX_FRAME_SIZE 0x5U + +-typedef struct nghttp3_settings_entry { +- uint64_t id; +- uint64_t value; +-} nghttp3_settings_entry; +- + typedef struct nghttp3_frame_settings { + uint64_t type; + size_t niv; +--- nghttp3-1.18.0.orig/lib/nghttp3_stream.c 2026-08-24 15:05:59.316597277 +0200 ++++ nghttp3-1.18.0/lib/nghttp3_stream.c 2026-08-24 15:13:24.606587507 +0200 +@@ -333,13 +333,16 @@ + nghttp3_buf *chunk; + nghttp3_typed_buf tbuf; + nghttp3_settings_entry ents16; +- nghttp3_frame_settings fr = { ++ nghttp3_frame_settings fr = *infr; ++ const nghttp3_settings *local_settings = infr->local_settings; ++ uint64_t payloadlen; ++ ++ if (local_settings) { ++ fr = (nghttp3_frame_settings){ + .type = NGHTTP3_FRAME_SETTINGS, + .niv = 3, + .iv = ents, + }; +- const nghttp3_settings *local_settings = infr->local_settings; +- uint64_t payloadlen; + + ents0 = (nghttp3_settings_entry){ + .id = NGHTTP3_SETTINGS_ID_MAX_FIELD_SECTION_SIZE, +@@ -371,6 +374,7 @@ + + ++fr.niv; + } ++ } + + len = nghttp3_frame_write_settings_len(&payloadlen, &fr); + +--- nghttp3-1.18.0.orig/tests/nghttp3_conn_test.c 2026-08-24 15:05:59.311966403 +0200 ++++ nghttp3-1.18.0/tests/nghttp3_conn_test.c 2026-08-24 15:06:12.561891072 +0200 +@@ -40,6 +40,7 @@ + static const MunitTest tests = { + munit_void_test(test_nghttp3_conn_read_control), + munit_void_test(test_nghttp3_conn_write_control), ++ munit_void_test(test_nghttp3_conn_submit_settings), + munit_void_test(test_nghttp3_conn_submit_request), + munit_void_test(test_nghttp3_conn_http_request), + munit_void_test(test_nghttp3_conn_http_resp_header), +@@ -1457,6 +1458,89 @@ + + nghttp3_conn_del(conn); + } ++ ++void test_nghttp3_conn_submit_settings(void) { ++ const nghttp3_mem *mem = nghttp3_mem_default(); ++ nghttp3_conn *conn; ++ nghttp3_callbacks callbacks; ++ nghttp3_settings settings; ++ nghttp3_settings_entry ents4; ++ nghttp3_settings_entry sent_ents16; ++ nghttp3_vec vec256; ++ nghttp3_frame fr; ++ nghttp3_ssize sveccnt, nread; ++ int64_t stream_id; ++ int fin; ++ int rv; ++ ++ memset(&callbacks, 0, sizeof(callbacks)); ++ nghttp3_settings_default(&settings); ++ ++ rv = nghttp3_conn_server_new(&conn, &callbacks, &settings, mem, NULL); ++ ++ assert_int(0, ==, rv); ++ ++ ents0 = (nghttp3_settings_entry){ ++ .id = NGHTTP3_SETTINGS_ID_ENABLE_CONNECT_PROTOCOL, ++ .value = 1, ++ }; ++ ents1 = (nghttp3_settings_entry){ ++ .id = NGHTTP3_SETTINGS_ID_H3_DATAGRAM, ++ .value = 1, ++ }; ++ ents2 = (nghttp3_settings_entry){ ++ .id = NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS, ++ .value = 111, ++ }; ++ ents3 = (nghttp3_settings_entry){ ++ .id = NGHTTP3_SETTINGS_ID_MAX_FIELD_SECTION_SIZE, ++ .value = 999, ++ }; ++ ++ rv = nghttp3_conn_submit_settings(conn, 0, NULL, 1); ++ ++ assert_int(NGHTTP3_ERR_INVALID_ARGUMENT, ==, rv); ++ ++ rv = nghttp3_conn_submit_settings(conn, 0, ents, nghttp3_arraylen(ents)); ++ ++ assert_int(0, ==, rv); ++ ++ rv = nghttp3_conn_bind_control_stream(conn, 3); ++ ++ assert_int(0, ==, rv); ++ ++ sveccnt = nghttp3_conn_writev_stream(conn, &stream_id, &fin, vec, ++ nghttp3_arraylen(vec)); ++ ++ assert_int64(3, ==, stream_id); ++ assert_ptrdiff(1, ==, sveccnt); ++ assert_size(1, <, vec0.len); ++ assert_uint8(NGHTTP3_STREAM_TYPE_CONTROL, ==, vec0.base0); ++ ++ ++vec0.base; ++ --vec0.len; ++ ++ fr.settings.iv = sent_ents; ++ nread = nghttp3_decode_settings_frame(&fr.settings, vec, 1); ++ ++ assert_ptrdiff((nghttp3_ssize)vec0.len, ==, nread); ++ assert_size(nghttp3_arraylen(ents), ==, fr.settings.niv); ++ ++ assert_uint64(ents0.id, ==, fr.settings.iv0.id); ++ assert_uint64(ents0.value, ==, fr.settings.iv0.value); ++ assert_uint64(ents1.id, ==, fr.settings.iv1.id); ++ assert_uint64(ents1.value, ==, fr.settings.iv1.value); ++ assert_uint64(ents2.id, ==, fr.settings.iv2.id); ++ assert_uint64(ents2.value, ==, fr.settings.iv2.value); ++ assert_uint64(ents3.id, ==, fr.settings.iv3.id); ++ assert_uint64(ents3.value, ==, fr.settings.iv3.value); ++ ++ rv = nghttp3_conn_submit_settings(conn, 0, ents, nghttp3_arraylen(ents)); ++ ++ assert_int(NGHTTP3_ERR_INVALID_STATE, ==, rv); ++ ++ nghttp3_conn_del(conn); ++} + + void test_nghttp3_conn_submit_request(void) { + nghttp3_conn *conn; +--- nghttp3-1.18.0.orig/tests/nghttp3_conn_test.h 2026-08-24 15:05:59.313116562 +0200 ++++ nghttp3-1.18.0/tests/nghttp3_conn_test.h 2026-08-24 15:06:12.562432493 +0200 +@@ -37,6 +37,7 @@ + + munit_void_test_decl(test_nghttp3_conn_read_control) + munit_void_test_decl(test_nghttp3_conn_write_control) ++munit_void_test_decl(test_nghttp3_conn_submit_settings) + munit_void_test_decl(test_nghttp3_conn_submit_request) + munit_void_test_decl(test_nghttp3_conn_http_request) + munit_void_test_decl(test_nghttp3_conn_http_resp_header)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.