MCPcopy Create free account
hub / github.com/apache/trafficserver / build_request

Method build_request

src/proxy/http/HttpTransact.cc:7684–7820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7682}
7683
7684void
7685HttpTransact::build_request(State *s, HTTPHdr *base_request, HTTPHdr *outgoing_request, HTTPVersion outgoing_version)
7686{
7687 // this part is to restore the original URL in case, multiple cache
7688 // lookups have happened - client request has been changed as the result
7689 //
7690 // notice that currently, based_request IS client_request
7691 if (base_request == &s->hdr_info.client_request) {
7692 if (!s->redirect_info.redirect_in_process) {
7693 // this is for multiple cache lookup
7694 URL *o_url = &s->cache_info.original_url;
7695
7696 if (o_url->valid()) {
7697 base_request->url_get()->copy(o_url);
7698 }
7699 }
7700
7701 // Perform any configured normalization (including per-remap-rule configuration overrides) of the Accept-Encoding header
7702 // field (if any). This has to be done in the request from the client, for the benefit of the gzip plugin.
7703 //
7704 HttpTransactHeaders::normalize_accept_encoding(s->txn_conf, base_request);
7705 }
7706
7707 HttpTransactHeaders::copy_header_fields(base_request, outgoing_request, s->txn_conf->fwd_proxy_auth_to_parent);
7708 add_client_ip_to_outgoing_request(s, outgoing_request);
7709 HttpTransactHeaders::add_forwarded_field_to_request(s, outgoing_request);
7710 HttpTransactHeaders::remove_privacy_headers_from_request(s->http_config_param, s->txn_conf, outgoing_request);
7711 HttpTransactHeaders::add_global_user_agent_header_to_request(s->txn_conf, outgoing_request);
7712 handle_request_keep_alive_headers(s, outgoing_version, outgoing_request);
7713
7714 if (s->next_hop_scheme < 0) {
7715 s->next_hop_scheme = URL_WKSIDX_HTTP;
7716 }
7717 if (s->orig_scheme < 0) {
7718 s->orig_scheme = URL_WKSIDX_HTTP;
7719 }
7720
7721 if (s->txn_conf->insert_request_via_string) {
7722 HttpTransactHeaders::insert_via_header_in_request(s, outgoing_request);
7723 }
7724
7725 // We build 1.1 request header and then convert as necessary to
7726 // the appropriate version in HttpTransact::build_request
7727 outgoing_request->version_set(HTTP_1_1);
7728
7729 // Make sure our request version is defined
7730 ink_assert(outgoing_version != HTTP_0_9);
7731
7732 // HttpTransactHeaders::convert_request(outgoing_version, outgoing_request); // commented out this idea
7733 URL *url = outgoing_request->url_get();
7734
7735 // Remove fragment from upstream URL
7736 url->fragment_set(nullptr, 0);
7737
7738 // Check whether a Host header field is missing from a 1.0 or 1.1 request.
7739 if (outgoing_version != HTTP_0_9 && !outgoing_request->presence(MIME_PRESENCE_HOST)) {
7740 int host_len;
7741 const char *host = url->host_get(&host_len);

Callers

nothing calls this directly

Calls 15

url_canonicalize_portFunction · 0.85
parent_is_proxyFunction · 0.85
ink_local_timeFunction · 0.85
dump_headerFunction · 0.85
incrementFunction · 0.85
url_getMethod · 0.80
version_setMethod · 0.80
fragment_setMethod · 0.80
presenceMethod · 0.80
method_get_wksidxMethod · 0.80

Tested by

no test coverage detected