| 903 | } |
| 904 | |
| 905 | bool url::set_protocol(const std::string_view input) { |
| 906 | std::string view(input); |
| 907 | helpers::remove_ascii_tab_or_newline(view); |
| 908 | if (view.empty()) { |
| 909 | return true; |
| 910 | } |
| 911 | |
| 912 | // Schemes should start with alpha values. |
| 913 | if (!checkers::is_alpha(view[0])) { |
| 914 | return false; |
| 915 | } |
| 916 | |
| 917 | view.append(":"); |
| 918 | |
| 919 | std::string::iterator pointer = |
| 920 | std::ranges::find_if_not(view, unicode::is_alnum_plus); |
| 921 | |
| 922 | if (pointer != view.end() && *pointer == ':') { |
| 923 | return parse_scheme<true>( |
| 924 | std::string_view(view.data(), pointer - view.begin())); |
| 925 | } |
| 926 | return false; |
| 927 | } |
| 928 | |
| 929 | bool url::set_href(const std::string_view input) { |
| 930 | ada::result<ada::url> out = ada::parse<ada::url>(input); |