| 6772 | } |
| 6773 | |
| 6774 | [[nodiscard]] ada_really_inline std::string url::get_href() const noexcept { |
| 6775 | std::string output = get_protocol(); |
| 6776 | |
| 6777 | if (host.has_value()) { |
| 6778 | output += "//"; |
| 6779 | if (has_credentials()) { |
| 6780 | output += username; |
| 6781 | if (!password.empty()) { |
| 6782 | output += ":" + get_password(); |
| 6783 | } |
| 6784 | output += "@"; |
| 6785 | } |
| 6786 | output += host.value(); |
| 6787 | if (port.has_value()) { |
| 6788 | output += ":" + get_port(); |
| 6789 | } |
| 6790 | } else if (!has_opaque_path && path.starts_with("//")) { |
| 6791 | // If url's host is null, url does not have an opaque path, url's path's |
| 6792 | // size is greater than 1, and url's path[0] is the empty string, then |
| 6793 | // append U+002F (/) followed by U+002E (.) to output. |
| 6794 | output += "/."; |
| 6795 | } |
| 6796 | output += path; |
| 6797 | if (query.has_value()) { |
| 6798 | output += "?" + query.value(); |
| 6799 | } |
| 6800 | if (hash.has_value()) { |
| 6801 | output += "#" + hash.value(); |
| 6802 | } |
| 6803 | return output; |
| 6804 | } |
| 6805 | |
| 6806 | ada_really_inline size_t url::parse_port(std::string_view view, |
| 6807 | bool check_trailing_content) noexcept { |
no test coverage detected