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

Function h2_headers_add_h1

modules/http2/h2_proxy_util.c:547–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545 ((nlen == sizeof(l) - 1) && !ap_cstr_casecmp(l, name))
546
547static apr_status_t h2_headers_add_h1(apr_table_t *headers, apr_pool_t *pool,
548 const char *name, size_t nlen,
549 const char *value, size_t vlen)
550{
551 char *hname, *hvalue;
552
553 if (h2_proxy_req_ignore_header(name, nlen)) {
554 return APR_SUCCESS;
555 }
556 else if (H2_HD_MATCH_LIT("cookie", name, nlen)) {
557 const char *existing = apr_table_get(headers, "cookie");
558 if (existing) {
559 char *nval;
560
561 /* Cookie header come separately in HTTP/2, but need
562 * to be merged by "; " (instead of default ", ")
563 */
564 hvalue = apr_pstrndup(pool, value, vlen);
565 nval = apr_psprintf(pool, "%s; %s", existing, hvalue);
566 apr_table_setn(headers, "Cookie", nval);
567 return APR_SUCCESS;
568 }
569 }
570 else if (H2_HD_MATCH_LIT("host", name, nlen)) {
571 if (apr_table_get(headers, "Host")) {
572 return APR_SUCCESS; /* ignore duplicate */
573 }
574 }
575
576 hname = apr_pstrndup(pool, name, nlen);
577 hvalue = apr_pstrndup(pool, value, vlen);
578 h2_proxy_util_camel_case_header(hname, nlen);
579 apr_table_mergen(headers, hname, hvalue);
580
581 return APR_SUCCESS;
582}
583
584static h2_proxy_request *h2_proxy_req_createn(int id, apr_pool_t *pool, const char *method,
585 const char *scheme, const char *authority,

Callers 1

set_h1_headerFunction · 0.85

Calls 2

Tested by

no test coverage detected