| 1470 | } |
| 1471 | |
| 1472 | static 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 |
no test coverage detected