| 1764 | { |
| 1765 | friend class HTTPHdr; |
| 1766 | UrlPrintHack(HTTPHdr *hdr) |
| 1767 | { |
| 1768 | hdr->_test_and_fill_target_cache(); |
| 1769 | if (hdr->m_url_cached.valid()) { |
| 1770 | URLImpl *ui = hdr->m_url_cached.m_url_impl; |
| 1771 | |
| 1772 | m_hdr = hdr; // mark as potentially having modified values. |
| 1773 | |
| 1774 | /* Get dirty. We reach in to the URL implementation to |
| 1775 | set the host and port if |
| 1776 | 1) They are not already set |
| 1777 | AND |
| 1778 | 2) The values were in a HTTP header. |
| 1779 | */ |
| 1780 | if (!hdr->m_target_in_url && hdr->m_host_length && hdr->m_host_mime) { |
| 1781 | ink_assert(nullptr == ui->m_ptr_host); // shouldn't be non-zero if not in URL. |
| 1782 | ui->m_ptr_host = hdr->m_host_mime->m_ptr_value; |
| 1783 | ui->m_len_host = hdr->m_host_length; |
| 1784 | m_host_modified_p = true; |
| 1785 | } else { |
| 1786 | m_host_modified_p = false; |
| 1787 | } |
| 1788 | |
| 1789 | if (0 == hdr->m_url_cached.port_get_raw() && hdr->m_port_in_header) { |
| 1790 | ink_assert(nullptr == ui->m_ptr_port); // shouldn't be set if not in URL. |
| 1791 | ui->m_ptr_port = m_port_buff; |
| 1792 | ui->m_len_port = snprintf(m_port_buff, sizeof(m_port_buff), "%d", hdr->m_port); |
| 1793 | ui->m_port = hdr->m_port; |
| 1794 | m_port_modified_p = true; |
| 1795 | } else { |
| 1796 | m_port_modified_p = false; |
| 1797 | } |
| 1798 | } else { |
| 1799 | m_hdr = nullptr; |
| 1800 | } |
| 1801 | } |
| 1802 | |
| 1803 | /// Destructor. |
| 1804 | ~UrlPrintHack() |
nothing calls this directly
no test coverage detected