| 1432 | } ngh_ctx; |
| 1433 | |
| 1434 | static 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 | |
| 1464 | static int add_table_header(void *ctx, const char *key, const char *value) |
| 1465 | { |
no test coverage detected