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

Function h2_proxy_stream_add_header_out

modules/http2/h2_proxy_session.c:406–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406static apr_status_t h2_proxy_stream_add_header_out(h2_proxy_stream *stream,
407 const char *n, apr_size_t nlen,
408 const char *v, apr_size_t vlen)
409{
410 if (n[0] == ':') {
411 if (!stream->data_received && !strncmp(":status", n, nlen)) {
412 char *s = apr_pstrndup(stream->r->pool, v, vlen);
413
414 apr_table_setn(stream->r->notes, "proxy-status", s);
415 ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->cfront,
416 "h2_proxy_stream(%s-%d): got status %s",
417 stream->session->id, stream->id, s);
418 stream->r->status = (int)apr_atoi64(s);
419 if (stream->r->status <= 0) {
420 stream->r->status = 500;
421 return APR_EGENERAL;
422 }
423 }
424 return APR_SUCCESS;
425 }
426
427 ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->cfront,
428 "h2_proxy_stream(%s-%d): on_header %s: %s",
429 stream->session->id, stream->id, n, v);
430 if (!h2_proxy_res_ignore_header(n, nlen)) {
431 char *hname, *hvalue;
432 apr_table_t *headers = (stream->headers_ended?
433 stream->r->trailers_out : stream->r->headers_out);
434
435 hname = apr_pstrndup(stream->pool, n, nlen);
436 h2_proxy_util_camel_case_header(hname, nlen);
437 hvalue = apr_pstrndup(stream->pool, v, vlen);
438
439 ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->cfront,
440 "h2_proxy_stream(%s-%d): got header %s: %s",
441 stream->session->id, stream->id, hname, hvalue);
442 process_proxy_header(headers, stream, hname, hvalue);
443 }
444 return APR_SUCCESS;
445}
446
447static int log_header(void *ctx, const char *key, const char *value)
448{

Callers 1

on_headerFunction · 0.85

Calls 3

process_proxy_headerFunction · 0.70

Tested by

no test coverage detected