| 12895 | } |
| 12896 | |
| 12897 | bool url::set_protocol(const std::string_view input) { |
| 12898 | std::string view(input); |
| 12899 | helpers::remove_ascii_tab_or_newline(view); |
| 12900 | if (view.empty()) { |
| 12901 | return true; |
| 12902 | } |
| 12903 | |
| 12904 | // Schemes should start with alpha values. |
| 12905 | if (!checkers::is_alpha(view[0])) { |
| 12906 | return false; |
| 12907 | } |
| 12908 | |
| 12909 | view.append(":"); |
| 12910 | |
| 12911 | std::string::iterator pointer = |
| 12912 | std::ranges::find_if_not(view, unicode::is_alnum_plus); |
| 12913 | |
| 12914 | if (pointer != view.end() && *pointer == ':') { |
| 12915 | return parse_scheme<true>( |
| 12916 | std::string_view(view.data(), pointer - view.begin())); |
| 12917 | } |
| 12918 | return false; |
| 12919 | } |
| 12920 | |
| 12921 | bool url::set_href(const std::string_view input) { |
| 12922 | ada::result<ada::url> out = ada::parse<ada::url>(input); |