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

Function add_header

modules/http2/h2_util.c:1434–1462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1432} ngh_ctx;
1433
1434static int add_header(ngh_ctx *ctx, const char *key, const char *value)
1435{
1436 nghttp2_nv *nv = &(ctx->ngh)->nv[(ctx->ngh)->nvlen++];
1437 const char *p;
1438
1439 if (!ctx->unsafe) {
1440 if ((p = inv_field_name_chr(key))) {
1441 ap_log_perror(APLOG_MARK, APLOG_TRACE1, APR_EINVAL, ctx->p,
1442 "h2_request: head field '%s: %s' has invalid char %s",
1443 key, value, p);
1444 ctx->status = APR_EINVAL;
1445 return 0;
1446 }
1447 if ((p = inv_field_value_chr(value))) {
1448 ap_log_perror(APLOG_MARK, APLOG_TRACE1, APR_EINVAL, ctx->p,
1449 "h2_request: head field '%s: %s' has invalid char %s",
1450 key, value, p);
1451 ctx->status = APR_EINVAL;
1452 return 0;
1453 }
1454 }
1455 nv->name = (uint8_t*)key;
1456 nv->namelen = strlen(key);
1457 nv->value = (uint8_t*)value;
1458 nv->valuelen = strlen(value);
1459 strip_field_value_ws(nv);
1460
1461 return 1;
1462}
1463
1464static int add_table_header(void *ctx, const char *key, const char *value)
1465{

Callers 2

add_table_headerFunction · 0.70
ngheader_createFunction · 0.70

Calls 3

inv_field_name_chrFunction · 0.85
inv_field_value_chrFunction · 0.85
strip_field_value_wsFunction · 0.85

Tested by

no test coverage detected