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

Method _fill_target_cache

src/proxy/hdrs/HTTP.cc:1696–1725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1694}
1695
1696void
1697HTTPHdr::_fill_target_cache() const
1698{
1699 URL *url = this->url_get();
1700 const char *port_ptr;
1701 int port_len;
1702
1703 m_target_in_url = false;
1704 m_port_in_header = false;
1705 m_host_mime = nullptr;
1706 // Check in the URL first, then the HOST field.
1707 if (nullptr != url->host_get(&m_host_length)) {
1708 m_target_in_url = true;
1709 m_port = url->port_get();
1710 m_port_in_header = 0 != url->port_get_raw();
1711 m_host_mime = nullptr;
1712 } else if (nullptr !=
1713 (m_host_mime = const_cast<HTTPHdr *>(this)->get_host_port_values(nullptr, &m_host_length, &port_ptr, &port_len))) {
1714 m_port = 0;
1715 if (port_ptr) {
1716 for (; port_len > 0 && isdigit(*port_ptr); ++port_ptr, --port_len) {
1717 m_port = m_port * 10 + *port_ptr - '0';
1718 }
1719 }
1720 m_port_in_header = (0 != m_port);
1721 m_port = url_canonicalize_port(url->m_url_impl->m_url_type, m_port);
1722 }
1723
1724 m_target_cached = true;
1725}
1726
1727void
1728HTTPHdr::set_url_target_from_host_field(URL *url)

Callers 1

Calls 6

url_getMethod · 0.95
url_canonicalize_portFunction · 0.85
port_get_rawMethod · 0.80
get_host_port_valuesMethod · 0.80
host_getMethod · 0.45
port_getMethod · 0.45

Tested by

no test coverage detected