| 1694 | } |
| 1695 | |
| 1696 | void |
| 1697 | HTTPHdr::_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 | |
| 1727 | void |
| 1728 | HTTPHdr::set_url_target_from_host_field(URL *url) |
no test coverage detected