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

Function ap_proxy_create_hdrbrgd

modules/proxy/proxy_util.c:4552–4841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4550}
4551
4552PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
4553 apr_bucket_brigade *header_brigade,
4554 request_rec *r,
4555 proxy_conn_rec *p_conn,
4556 proxy_worker *worker,
4557 proxy_server_conf *conf,
4558 apr_uri_t *uri,
4559 char *url, char *server_portstr,
4560 char **old_cl_val,
4561 char **old_te_val)
4562{
4563 int rc = OK;
4564 conn_rec *c = r->connection;
4565 int counter;
4566 char *buf;
4567 apr_table_t *saved_headers_in = r->headers_in;
4568 const char *saved_host = apr_table_get(saved_headers_in, "Host");
4569 const apr_array_header_t *headers_in_array;
4570 const apr_table_entry_t *headers_in;
4571 apr_bucket *e;
4572 int force10 = 0, do_100_continue = 0;
4573 conn_rec *origin = p_conn->connection;
4574 const char *host, *creds, *val;
4575 proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
4576
4577 /*
4578 * HTTP "Ping" test? Easiest is 100-Continue. However:
4579 * To be compliant, we only use 100-Continue for requests with bodies.
4580 * We also make sure we won't be talking HTTP/1.0 as well.
4581 */
4582 if (apr_table_get(r->subprocess_env, "force-proxy-request-1.0")) {
4583 force10 = 1;
4584 }
4585 else if (apr_table_get(r->notes, "proxy-100-continue")
4586 || PROXY_SHOULD_PING_100_CONTINUE(worker, r)) {
4587 do_100_continue = 1;
4588 }
4589 if (force10 || apr_table_get(r->subprocess_env, "proxy-nokeepalive")) {
4590 if (origin) {
4591 origin->keepalive = AP_CONN_CLOSE;
4592 }
4593 p_conn->close = 1;
4594 }
4595
4596 if (force10) {
4597 buf = apr_pstrcat(p, r->method, " ", url, " HTTP/1.0" CRLF, NULL);
4598 }
4599 else {
4600 buf = apr_pstrcat(p, r->method, " ", url, " HTTP/1.1" CRLF, NULL);
4601 }
4602 ap_xlate_proto_to_ascii(buf, strlen(buf));
4603 e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
4604 APR_BRIGADE_INSERT_TAIL(header_brigade, e);
4605
4606 /*
4607 * Make a copy on r->headers_in for the request we make to the backend,
4608 * modify the copy in place according to our configuration and connection
4609 * handling, use it to fill in the forwarded headers' brigade, and finally

Callers 2

ap_proxy_http_prefetchFunction · 0.85
proxy_wstunnel_requestFunction · 0.85

Calls 7

ap_get_module_configFunction · 0.85
ap_xlate_proto_to_asciiFunction · 0.85
ap_strchr_cFunction · 0.85
ap_get_server_nameFunction · 0.85
ap_cstr_casecmpFunction · 0.85
ap_find_tokenFunction · 0.85

Tested by

no test coverage detected