MCPcopy Create free account
hub / github.com/apache/httpd / ngheader_create

Function ngheader_create

modules/http2/h2_util.c:1472–1506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1470}
1471
1472static apr_status_t ngheader_create(h2_ngheader **ph, apr_pool_t *p,
1473 int unsafe, size_t key_count,
1474 const char *keys[], const char *values[],
1475 apr_table_t *headers)
1476{
1477 ngh_ctx ctx;
1478 size_t n, i;
1479
1480 ctx.p = p;
1481 ctx.unsafe = unsafe;
1482
1483 n = key_count;
1484 apr_table_do(count_header, &n, headers, NULL);
1485
1486 *ph = ctx.ngh = apr_pcalloc(p, sizeof(h2_ngheader));
1487 if (!ctx.ngh) {
1488 return APR_ENOMEM;
1489 }
1490
1491 ctx.ngh->nv = apr_pcalloc(p, n * sizeof(nghttp2_nv));
1492 if (!ctx.ngh->nv) {
1493 return APR_ENOMEM;
1494 }
1495
1496 ctx.status = APR_SUCCESS;
1497 for (i = 0; i < key_count; ++i) {
1498 if (!add_header(&ctx, keys[i], values[i])) {
1499 return ctx.status;
1500 }
1501 }
1502
1503 apr_table_do(add_table_header, &ctx, headers, NULL);
1504
1505 return ctx.status;
1506}
1507
1508#if AP_HAS_RESPONSE_BUCKETS
1509

Callers 3

h2_res_create_ngtrailerFunction · 0.85
h2_res_create_ngheaderFunction · 0.85
h2_req_create_ngheaderFunction · 0.85

Calls 1

add_headerFunction · 0.70

Tested by

no test coverage detected