mirror of
https://github.com/curl/curl.git
synced 2026-08-05 08:36:13 +03:00
http2: header conversion tightening
- fold the code to convert dynhds to the nghttp2 structs into a dynhds internal method - saves code duplication - pacifies compiler analyzers Closes #12097
This commit is contained in:
parent
f76fcd6f4d
commit
117c9bd978
4 changed files with 40 additions and 23 deletions
12
lib/http2.c
12
lib/http2.c
|
|
@ -2057,23 +2057,13 @@ static ssize_t h2_submit(struct stream_ctx **pstream,
|
|||
/* no longer needed */
|
||||
Curl_h1_req_parse_free(&stream->h1);
|
||||
|
||||
nheader = Curl_dynhds_count(&h2_headers);
|
||||
nva = malloc(sizeof(nghttp2_nv) * nheader);
|
||||
nva = Curl_dynhds_to_nva(&h2_headers, &nheader);
|
||||
if(!nva) {
|
||||
*err = CURLE_OUT_OF_MEMORY;
|
||||
nwritten = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for(i = 0; i < nheader; ++i) {
|
||||
struct dynhds_entry *e = Curl_dynhds_getn(&h2_headers, i);
|
||||
nva[i].name = (unsigned char *)e->name;
|
||||
nva[i].namelen = e->namelen;
|
||||
nva[i].value = (unsigned char *)e->value;
|
||||
nva[i].valuelen = e->valuelen;
|
||||
nva[i].flags = NGHTTP2_NV_FLAG_NONE;
|
||||
}
|
||||
|
||||
h2_pri_spec(data, &pri_spec);
|
||||
if(!nghttp2_session_check_request_allowed(ctx->h2))
|
||||
CURL_TRC_CF(data, cf, "send request NOT allowed (via nghttp2)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue