mirror of
https://github.com/curl/curl.git
synced 2026-08-26 09:23:31 +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
|
|
@ -909,7 +909,6 @@ static CURLcode proxy_h2_submit(int32_t *pstream_id,
|
|||
{
|
||||
struct dynhds h2_headers;
|
||||
nghttp2_nv *nva = NULL;
|
||||
unsigned int i;
|
||||
int32_t stream_id = -1;
|
||||
size_t nheader;
|
||||
CURLcode result;
|
||||
|
|
@ -920,22 +919,12 @@ static CURLcode proxy_h2_submit(int32_t *pstream_id,
|
|||
if(result)
|
||||
goto out;
|
||||
|
||||
nheader = Curl_dynhds_count(&h2_headers);
|
||||
nva = malloc(sizeof(nghttp2_nv) * nheader);
|
||||
nva = Curl_dynhds_to_nva(&h2_headers, &nheader);
|
||||
if(!nva) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
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;
|
||||
}
|
||||
|
||||
if(read_callback) {
|
||||
nghttp2_data_provider data_prd;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue