16template <
bool has_state_overr
ide>
18 const std::string_view input_with_colon) {
19 ada_log(
"url_aggregator::parse_scheme_with_colon ", input_with_colon);
22 std::string_view input{input_with_colon};
23 input.remove_suffix(1);
30 if (is_input_special) {
31 if constexpr (has_state_override) {
54 set_scheme_from_view_with_colon(input_with_colon);
56 if constexpr (has_state_override) {
62 if (components.
port == urls_scheme_port) {
67 std::string _buffer(input);
71 unicode::to_lower_ascii(_buffer.data(), _buffer.size());
73 if constexpr (has_state_override) {
77 if (
is_special() != ada::scheme::is_special(_buffer)) {
98 if constexpr (has_state_override) {
104 if (components.
port == urls_scheme_port) {
113inline void url_aggregator::copy_scheme(
const url_aggregator& u)
noexcept {
114 ada_log(
"url_aggregator::copy_scheme ", u.buffer);
118 uint32_t new_difference = u.components.protocol_end - components.protocol_end;
120 buffer.erase(0, components.protocol_end);
121 buffer.insert(0, u.get_protocol());
122 components.protocol_end = u.components.protocol_end;
125 if (new_difference == 0) {
130 components.username_end += new_difference;
131 components.host_start += new_difference;
132 components.host_end += new_difference;
133 components.pathname_start += new_difference;
135 components.search_start += new_difference;
138 components.hash_start += new_difference;
143inline void url_aggregator::set_scheme_from_view_with_colon(
144 std::string_view new_scheme_with_colon)
noexcept {
145 ada_log(
"url_aggregator::set_scheme_from_view_with_colon ",
146 new_scheme_with_colon);
149 new_scheme_with_colon.back() ==
':');
152 uint32_t new_difference =
153 uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
155 if (buffer.empty()) {
156 buffer.append(new_scheme_with_colon);
158 buffer.erase(0, components.protocol_end);
159 buffer.insert(0, new_scheme_with_colon);
161 components.protocol_end += new_difference;
164 components.username_end += new_difference;
165 components.host_start += new_difference;
166 components.host_end += new_difference;
167 components.pathname_start += new_difference;
169 components.search_start += new_difference;
172 components.hash_start += new_difference;
177inline void url_aggregator::set_scheme(std::string_view new_scheme)
noexcept {
178 ada_log(
"url_aggregator::set_scheme ", new_scheme);
183 uint32_t new_difference =
184 uint32_t(new_scheme.size()) - components.protocol_end + 1;
187 if (buffer.empty()) {
188 buffer.append(helpers::concat(new_scheme,
":"));
190 buffer.erase(0, components.protocol_end);
191 buffer.insert(0, helpers::concat(new_scheme,
":"));
193 components.protocol_end = uint32_t(new_scheme.size() + 1);
196 components.username_end += new_difference;
197 components.host_start += new_difference;
198 components.host_end += new_difference;
199 components.pathname_start += new_difference;
201 components.search_start += new_difference;
204 components.hash_start += new_difference;
210 ada_log(
"url_aggregator::set_protocol ", input);
213 std::string view(input);
214 helpers::remove_ascii_tab_or_newline(view);
226 std::string::iterator pointer =
227 std::ranges::find_if_not(view, unicode::is_alnum_plus);
229 if (pointer != view.end() && *pointer ==
':') {
230 return parse_scheme_with_colon<true>(
231 std::string_view(view.data(), pointer - view.begin() + 1));
237 ada_log(
"url_aggregator::set_username '", input,
"' ");
240 if (cannot_have_credentials_or_port()) {
245 if (idx == input.size()) {
246 update_base_username(input);
249 update_base_username(ada::unicode::percent_encode(
257 ada_log(
"url_aggregator::set_password '", input,
"'");
260 if (cannot_have_credentials_or_port()) {
265 if (idx == input.size()) {
266 update_base_password(input);
269 update_base_password(ada::unicode::percent_encode(
277 ada_log(
"url_aggregator::set_port ", input);
280 if (cannot_have_credentials_or_port()) {
283 std::string trimmed(input);
284 helpers::remove_ascii_tab_or_newline(trimmed);
285 if (trimmed.empty()) {
290 if (ada::unicode::is_c0_control_or_space(trimmed.front())) {
294 if (input.find_first_of(
"0123456789") == std::string_view::npos) {
299 uint32_t previous_port = components.
port;
304 update_base_port(previous_port);
311 ada_log(
"url_aggregator::set_pathname ", input);
319 if (
get_pathname().starts_with(
"//") && !has_authority() && !has_dash_dot()) {
328 ada_log(
"url_aggregator::parse_path ", input);
331 std::string tmp_buffer;
332 std::string_view internal_input;
333 if (unicode::has_tabs_or_newline(input)) {
337 helpers::remove_ascii_tab_or_newline(tmp_buffer);
338 internal_input = tmp_buffer;
340 internal_input = input;
345 if (internal_input.empty()) {
346 update_base_pathname(
"/");
347 }
else if ((internal_input[0] ==
'/') || (internal_input[0] ==
'\\')) {
348 consume_prepared_path(internal_input.substr(1));
350 consume_prepared_path(internal_input);
352 }
else if (!internal_input.empty()) {
353 if (internal_input[0] ==
'/') {
354 consume_prepared_path(internal_input.substr(1));
356 consume_prepared_path(internal_input);
362 update_base_pathname(
"/");
369 ada_log(
"url_aggregator::set_search ", input);
374 helpers::strip_trailing_spaces_from_opaque_path(*
this);
378 std::string new_value;
379 new_value = input[0] ==
'?' ? input.substr(1) : input;
380 helpers::remove_ascii_tab_or_newline(new_value);
382 auto query_percent_encode_set =
386 update_base_search(new_value, query_percent_encode_set);
391 ada_log(
"url_aggregator::set_hash ", input);
399 helpers::strip_trailing_spaces_from_opaque_path(*
this);
403 std::string new_value;
404 new_value = input[0] ==
'#' ? input.substr(1) : input;
405 helpers::remove_ascii_tab_or_newline(new_value);
406 update_unencoded_base_hash(new_value);
412 ada_log(
"url_aggregator::set_href ", input,
" [", input.size(),
" bytes]");
414 ada_log(
"url_aggregator::set_href, success :", out.has_value());
417 ada_log(
"url_aggregator::set_href, parsed ", out->to_string());
422 return out.has_value();
426 ada_log(
"url_aggregator:parse_host \"", input,
"\" [", input.size(),
434 if (input[0] ==
'[') {
436 if (input.back() !=
']') {
439 ada_log(
"parse_host ipv6");
443 input.remove_prefix(1);
444 input.remove_suffix(1);
445 return parse_ipv6(input);
451 return parse_opaque_host(input);
462 uint8_t is_forbidden_or_upper =
463 unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
471 if (is_forbidden_or_upper == 0 &&
472 input.find(
"xn-") == std::string_view::npos) {
474 update_base_hostname(input);
476 ada_log(
"parse_host fast path ipv4");
486 ada_log(
"parse_host calling to_ascii");
487 std::optional<std::string> host = std::string(
get_hostname());
488 is_valid = ada::unicode::to_ascii(host, input, input.find(
'%'));
490 ada_log(
"parse_host to_ascii returns false");
493 ada_log(
"parse_host to_ascii succeeded ", *host,
" [", host->size(),
496 if (std::any_of(host.value().begin(), host.value().end(),
497 ada::unicode::is_forbidden_domain_code_point)) {
503 if (checkers::is_ipv4(host.value())) {
504 ada_log(
"parse_host got ipv4 ", *host);
505 return parse_ipv4(host.value(),
false);
508 update_base_hostname(host.value());
513template <
bool overr
ide_hostname>
514bool url_aggregator::set_host_or_hostname(
const std::string_view input) {
515 ada_log(
"url_aggregator::set_host_or_hostname ", input);
523 uint32_t previous_port = components.
port;
525 size_t host_end_pos = input.find(
'#');
526 std::string _host(input.data(), host_end_pos != std::string_view::npos
529 helpers::remove_ascii_tab_or_newline(_host);
530 std::string_view new_host(_host);
535 std::string_view host_view(_host.data(), _host.length());
536 auto [location, found_colon] =
537 helpers::get_host_delimiter_location(
is_special(), host_view);
543 if constexpr (override_hostname) {
546 std::string_view sub_buffer = new_host.substr(location + 1);
547 if (!sub_buffer.empty()) {
555 else if (host_view.empty() &&
564 }
else if (has_dash_dot()) {
565 add_authority_slashes_if_needed();
571 bool succeeded = parse_host(host_view);
573 update_base_hostname(previous_host);
574 update_base_port(previous_port);
575 }
else if (has_dash_dot()) {
582 size_t location = new_host.find_first_of(
"/\\?");
583 if (location != std::string_view::npos) {
584 new_host.remove_suffix(new_host.length() - location);
587 if (new_host.empty()) {
592 if (!parse_host(new_host)) {
593 update_base_hostname(previous_host);
594 update_base_port(previous_port);
599 if (helpers::substring(buffer, components.
host_start,
600 components.
host_end) ==
"localhost") {
609 ada_log(
"url_aggregator::set_host '", input,
"'");
612 return set_host_or_hostname<false>(input);
616 ada_log(
"url_aggregator::set_hostname '", input,
"'");
619 return set_host_or_hostname<true>(input);
623 ada_log(
"url_aggregator::get_origin");
640 return helpers::concat(out->get_protocol(),
"//", out->get_host());
651 ada_log(
"url_aggregator::get_username");
653 return helpers::substring(buffer, components.
protocol_end + 2,
661 ada_log(
"url_aggregator::get_password");
663 return helpers::substring(buffer, components.
username_end + 1,
671 ada_log(
"url_aggregator::get_port");
675 return helpers::substring(buffer, components.
host_end + 1,
681 ada_log(
"url_aggregator::get_hash");
687 if (buffer.size() - components.
hash_start <= 1) {
690 return helpers::substring(buffer, components.
hash_start);
695 ada_log(
"url_aggregator::get_host");
709 return helpers::substring(buffer, start, components.
pathname_start);
714 ada_log(
"url_aggregator::get_hostname");
724 return helpers::substring(buffer, start, components.
host_end);
729 ada_log(
"url_aggregator::get_search");
735 auto ending_index = uint32_t(buffer.size());
742 return helpers::substring(buffer, components.
search_start, ending_index);
747 ada_log(
"url_aggregator::get_protocol");
748 return helpers::substring(buffer, 0, components.
protocol_end);
752 ada_log(
"url_aggregator::to_string buffer:", buffer,
" [", buffer.size(),
759 auto back = std::back_insert_iterator(answer);
760 answer.append(
"{\n");
762 answer.append(
"\t\"buffer\":\"");
763 helpers::encode_json(buffer, back);
764 answer.append(
"\",\n");
766 answer.append(
"\t\"protocol\":\"");
767 helpers::encode_json(get_protocol(), back);
768 answer.append(
"\",\n");
770 if (has_credentials()) {
771 answer.append(
"\t\"username\":\"");
772 helpers::encode_json(get_username(), back);
773 answer.append(
"\",\n");
774 answer.append(
"\t\"password\":\"");
775 helpers::encode_json(get_password(), back);
776 answer.append(
"\",\n");
779 answer.append(
"\t\"host\":\"");
780 helpers::encode_json(get_host(), back);
781 answer.append(
"\",\n");
783 answer.append(
"\t\"path\":\"");
784 helpers::encode_json(get_pathname(), back);
785 answer.append(
"\",\n");
786 answer.append(
"\t\"opaque path\":");
787 answer.append((has_opaque_path ?
"true" :
"false"));
788 answer.append(
",\n");
791 answer.append(
"\t\"query\":\"");
792 helpers::encode_json(get_search(), back);
793 answer.append(
"\",\n");
796 answer.append(
"\t\"fragment\":\"");
797 helpers::encode_json(get_hash(), back);
798 answer.append(
"\",\n");
801 auto convert_offset_to_string = [](uint32_t offset) -> std::string {
805 return std::to_string(offset);
809 answer.append(
"\t\"protocol_end\":");
810 answer.append(convert_offset_to_string(components.protocol_end));
811 answer.append(
",\n");
813 answer.append(
"\t\"username_end\":");
814 answer.append(convert_offset_to_string(components.username_end));
815 answer.append(
",\n");
817 answer.append(
"\t\"host_start\":");
818 answer.append(convert_offset_to_string(components.host_start));
819 answer.append(
",\n");
821 answer.append(
"\t\"host_end\":");
822 answer.append(convert_offset_to_string(components.host_end));
823 answer.append(
",\n");
825 answer.append(
"\t\"port\":");
826 answer.append(convert_offset_to_string(components.port));
827 answer.append(
",\n");
829 answer.append(
"\t\"pathname_start\":");
830 answer.append(convert_offset_to_string(components.pathname_start));
831 answer.append(
",\n");
833 answer.append(
"\t\"search_start\":");
834 answer.append(convert_offset_to_string(components.search_start));
835 answer.append(
",\n");
837 answer.append(
"\t\"hash_start\":");
838 answer.append(convert_offset_to_string(components.hash_start));
839 answer.append(
"\n}");
851bool url_aggregator::parse_ipv4(std::string_view input,
bool in_place) {
852 ada_log(
"parse_ipv4 ", input,
" [", input.size(),
853 " bytes], overlaps with buffer: ",
854 helpers::overlaps(input, buffer) ?
"yes" :
"no");
856 const bool trailing_dot = (input.back() ==
'.');
858 input.remove_suffix(1);
860 size_t digit_count{0};
861 int pure_decimal_count = 0;
864 for (; (digit_count < 4) && !(input.empty()); digit_count++) {
868 if (is_hex && ((input.length() == 2) ||
869 ((input.length() > 2) && (input[2] ==
'.')))) {
872 input.remove_prefix(2);
874 std::from_chars_result r{};
876 ada_log(
"parse_ipv4 trying to parse hex number");
877 r = std::from_chars(input.data() + 2, input.data() + input.size(),
879 }
else if ((input.length() >= 2) && input[0] ==
'0' &&
881 ada_log(
"parse_ipv4 trying to parse octal number");
882 r = std::from_chars(input.data() + 1, input.data() + input.size(),
885 ada_log(
"parse_ipv4 trying to parse decimal number");
886 pure_decimal_count++;
887 r = std::from_chars(input.data(), input.data() + input.size(),
890 if (r.ec != std::errc()) {
891 ada_log(
"parse_ipv4 parsing failed");
894 ada_log(
"parse_ipv4 parsed ", segment_result);
895 input.remove_prefix(r.ptr - input.data());
901 if (segment_result >= (uint64_t(1) << (32 - digit_count * 8))) {
904 ipv4 <<= (32 - digit_count * 8);
905 ipv4 |= segment_result;
910 if ((segment_result > 255) || (input[0] !=
'.')) {
914 ipv4 |= segment_result;
915 input.remove_prefix(1);
918 if ((digit_count != 4) || (!input.empty())) {
919 ada_log(
"parse_ipv4 found invalid (more than 4 numbers or empty) ");
923 ada_log(
"url_aggregator::parse_ipv4 completed ",
get_href(),
927 if (in_place && pure_decimal_count == 4 && !trailing_dot) {
929 "url_aggregator::parse_ipv4 completed and was already correct in the "
934 ada_log(
"url_aggregator::parse_ipv4 completed and we need to update it");
939 update_base_hostname(
947bool url_aggregator::parse_ipv6(std::string_view input) {
952 ada_log(
"parse_ipv6 ", input,
" [", input.size(),
" bytes]");
959 std::array<uint16_t, 8> address{};
965 std::optional<int> compress{};
968 std::string_view::iterator pointer = input.begin();
971 if (input[0] ==
':') {
974 if (input.size() == 1 || input[1] !=
':') {
975 ada_log(
"parse_ipv6 starts with : but the rest does not start with :");
983 compress = ++piece_index;
987 while (pointer != input.end()) {
989 if (piece_index == 8) {
990 ada_log(
"parse_ipv6 piece_index == 8");
995 if (*pointer ==
':') {
997 if (compress.has_value()) {
998 ada_log(
"parse_ipv6 compress is non-null");
1005 compress = ++piece_index;
1010 uint16_t value = 0, length = 0;
1015 while (length < 4 && pointer != input.end() &&
1016 unicode::is_ascii_hex_digit(*pointer)) {
1018 value = uint16_t(value * 0x10 + unicode::convert_hex_to_binary(*pointer));
1024 if (pointer != input.end() && *pointer ==
'.') {
1027 ada_log(
"parse_ipv6 length is 0");
1035 if (piece_index > 6) {
1036 ada_log(
"parse_ipv6 piece_index > 6");
1041 int numbers_seen = 0;
1044 while (pointer != input.end()) {
1046 std::optional<uint16_t> ipv4_piece{};
1049 if (numbers_seen > 0) {
1052 if (*pointer ==
'.' && numbers_seen < 4) {
1056 ada_log(
"parse_ipv6 Otherwise, validation error, return failure");
1064 "parse_ipv6 If c is not an ASCII digit, validation error, return "
1072 int number = *pointer -
'0';
1075 if (!ipv4_piece.has_value()) {
1076 ipv4_piece = number;
1079 else if (ipv4_piece == 0) {
1080 ada_log(
"parse_ipv6 if ipv4Piece is 0, validation error");
1085 ipv4_piece = *ipv4_piece * 10 + number;
1089 if (ipv4_piece > 255) {
1090 ada_log(
"parse_ipv6 ipv4_piece > 255");
1101 address[piece_index] =
1102 uint16_t(address[piece_index] * 0x100 + *ipv4_piece);
1108 if (numbers_seen == 2 || numbers_seen == 4) {
1114 if (numbers_seen != 4) {
1122 else if ((pointer != input.end()) && (*pointer ==
':')) {
1127 if (pointer == input.end()) {
1129 "parse_ipv6 If c is the EOF code point, validation error, return "
1136 else if (pointer != input.end()) {
1138 "parse_ipv6 Otherwise, if c is not the EOF code point, validation "
1139 "error, return failure");
1144 address[piece_index] = value;
1151 if (compress.has_value()) {
1153 int swaps = piece_index - *compress;
1161 while (piece_index != 0 && swaps > 0) {
1162 std::swap(address[piece_index], address[*compress + swaps - 1]);
1169 else if (piece_index != 8) {
1171 "parse_ipv6 if compress is null and pieceIndex is not 8, validation "
1172 "error, return failure");
1185bool url_aggregator::parse_opaque_host(std::string_view input) {
1186 ada_log(
"parse_opaque_host ", input,
" [", input.size(),
" bytes]");
1189 if (std::any_of(input.begin(), input.end(),
1190 ada::unicode::is_forbidden_host_code_point)) {
1198 if (idx == input.size()) {
1199 update_base_hostname(input);
1202 update_base_hostname(ada::unicode::percent_encode(
1214 answer.append(buffer);
1215 answer.append(
" [");
1216 answer.append(std::to_string(buffer.size()));
1217 answer.append(
" bytes]");
1218 answer.append(
"\n");
1221 line1.resize(buffer.size(),
' ');
1231 if (components.
host_end != buffer.size()) {
1234 if (components.
host_start != buffer.size()) {
1243 answer.append(line1);
1244 answer.append(
"\n");
1246 std::string line2 = line1;
1251 for (
size_t i = components.
hash_start + 1; i < line2.size(); i++) {
1254 line2.append(
" hash_start");
1255 answer.append(line2);
1256 answer.append(
"\n");
1259 std::string line3 = line1;
1264 for (
size_t i = components.
search_start + 1; i < line3.size(); i++) {
1267 line3.append(
" search_start ");
1269 answer.append(line3);
1270 answer.append(
"\n");
1273 std::string line4 = line1;
1277 for (
size_t i = components.
pathname_start + 1; i < line4.size(); i++) {
1280 line4.append(
" pathname_start ");
1282 answer.append(line4);
1283 answer.append(
"\n");
1286 std::string line5 = line1;
1287 if (components.
host_end != buffer.size()) {
1291 for (
size_t i = components.
host_end + 1; i < line5.size(); i++) {
1294 line5.append(
" host_end ");
1295 line5.append(std::to_string(components.
host_end));
1296 answer.append(line5);
1297 answer.append(
"\n");
1300 std::string line6 = line1;
1301 if (components.
host_start != buffer.size()) {
1305 for (
size_t i = components.
host_start + 1; i < line6.size(); i++) {
1308 line6.append(
" host_start ");
1309 line6.append(std::to_string(components.
host_start));
1310 answer.append(line6);
1311 answer.append(
"\n");
1314 std::string line7 = line1;
1319 for (
size_t i = components.
username_end + 1; i < line7.size(); i++) {
1322 line7.append(
" username_end ");
1324 answer.append(line7);
1325 answer.append(
"\n");
1328 std::string line8 = line1;
1333 for (
size_t i = components.
protocol_end + 1; i < line8.size(); i++) {
1336 line8.append(
" protocol_end ");
1338 answer.append(line8);
1339 answer.append(
"\n");
1343 answer.append(
"note: hash omitted\n");
1346 answer.append(
"note: search omitted\n");
1349 answer.append(
"warning: protocol_end overflows\n");
1352 answer.append(
"warning: username_end overflows\n");
1355 answer.append(
"warning: host_start overflows\n");
1357 if (components.
host_end > buffer.size()) {
1358 answer.append(
"warning: host_end overflows\n");
1361 answer.append(
"warning: pathname_start overflows\n");
1366void url_aggregator::delete_dash_dot() {
1367 ada_log(
"url_aggregator::delete_dash_dot");
1370 buffer.erase(components.
host_end, 2);
1382inline void url_aggregator::consume_prepared_path(std::string_view input) {
1383 ada_log(
"url_aggregator::consume_prepared_path ", input);
1393 uint8_t accumulator = checkers::path_signature(input);
1398 constexpr uint8_t need_encoding = 1;
1399 constexpr uint8_t backslash_char = 2;
1400 constexpr uint8_t dot_char = 4;
1401 constexpr uint8_t percent_char = 8;
1406 (special ? (accumulator == 0)
1407 : ((accumulator & (need_encoding | dot_char | percent_char)) ==
1409 (!may_need_slow_file_handling);
1410 if (accumulator == dot_char && !may_need_slow_file_handling) {
1418 if (input[0] !=
'.') {
1419 size_t slashdot = input.find(
"/.");
1420 if (slashdot == std::string_view::npos) {
1421 trivial_path =
true;
1425 !(slashdot + 2 == input.size() || input[slashdot + 2] ==
'.' ||
1426 input[slashdot + 2] ==
'/');
1430 if (trivial_path && is_at_path()) {
1431 ada_log(
"parse_path trivial");
1443 (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
1446 ada_log(
"parse_prepared_path fast");
1451 size_t previous_location = 0;
1453 size_t new_location = input.find(
'/', previous_location);
1456 if (new_location == std::string_view::npos) {
1457 std::string_view path_view = input.substr(previous_location);
1458 if (path_view ==
"..") {
1462 update_base_pathname(path);
1466 if (path.back() ==
'/') {
1467 update_base_pathname(path);
1472 path.resize(path.rfind(
'/') + 1);
1473 update_base_pathname(path);
1477 if (path_view !=
".") {
1478 path.append(path_view);
1480 update_base_pathname(path);
1484 std::string_view path_view =
1485 input.substr(previous_location, new_location - previous_location);
1486 previous_location = new_location + 1;
1487 if (path_view ==
"..") {
1488 size_t last_delimiter = path.rfind(
'/');
1489 if (last_delimiter != std::string::npos) {
1490 path.erase(last_delimiter);
1492 }
else if (path_view !=
".") {
1494 path.append(path_view);
1499 ada_log(
"parse_path slow");
1501 bool needs_percent_encoding = (accumulator & 1);
1502 std::string path_buffer_tmp;
1504 size_t location = (special && (accumulator & 2))
1505 ? input.find_first_of(
"/\\")
1507 std::string_view path_view = input;
1508 if (location != std::string_view::npos) {
1509 path_view.remove_suffix(path_view.size() - location);
1510 input.remove_prefix(location + 1);
1514 std::string_view path_buffer =
1515 (needs_percent_encoding &&
1516 ada::unicode::percent_encode<false>(
1520 if (unicode::is_double_dot_path_segment(path_buffer)) {
1521 if ((helpers::shorten_path(path, type) || special) &&
1522 location == std::string_view::npos) {
1525 }
else if (unicode::is_single_dot_path_segment(path_buffer) &&
1526 (location == std::string_view::npos)) {
1530 else if (!unicode::is_single_dot_path_segment(path_buffer)) {
1537 path += path_buffer[0];
1539 path_buffer.remove_prefix(2);
1540 path.append(path_buffer);
1544 path.append(path_buffer);
1547 if (location == std::string_view::npos) {
1548 update_base_pathname(path);
Includes all definitions for Ada.
Definitions for URL specific checkers used within Ada.
#define ADA_ASSERT_TRUE(COND)
#define ada_lifetime_bound
#define ada_really_inline
Definitions for helper functions used within Ada.
Definitions for user facing functions for parsing URL and it's components.
constexpr uint8_t QUERY_PERCENT_ENCODE[32]
constexpr uint8_t SPECIAL_QUERY_PERCENT_ENCODE[32]
constexpr uint8_t PATH_PERCENT_ENCODE[32]
constexpr uint8_t C0_CONTROL_PERCENT_ENCODE[32]
constexpr uint8_t USERINFO_PERCENT_ENCODE[32]
constexpr bool has_hex_prefix(std::string_view input)
constexpr bool is_windows_drive_letter(std::string_view input) noexcept
constexpr bool is_alpha(char x) noexcept
constexpr bool is_digit(char x) noexcept
constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept
constexpr uint16_t get_special_port(std::string_view scheme) noexcept
std::string ipv6(const std::array< uint16_t, 8 > &address) noexcept
std::string ipv4(uint64_t address) noexcept
ada_really_inline size_t percent_encode_index(const std::string_view input, const uint8_t character_set[])
template ada::result< url_aggregator > parse< url_aggregator >(std::string_view input, const url_aggregator *base_url)
tl::expected< result_type, ada::errors > result
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
Declarations for the URL scheme.
constexpr bool has_non_empty_password() const noexcept
void set_hash(std::string_view input)
constexpr bool validate() const noexcept
void clear_search() override
std::string_view get_hostname() const noexcept ada_lifetime_bound
std::string to_string() const override
std::string_view get_hash() const noexcept ada_lifetime_bound
std::string to_diagram() const
constexpr bool has_hostname() const noexcept
bool set_protocol(std::string_view input)
std::string get_origin() const noexcept override
constexpr std::string_view get_href() const noexcept ada_lifetime_bound
std::string_view get_search() const noexcept ada_lifetime_bound
bool has_valid_domain() const noexcept override
bool set_hostname(std::string_view input)
bool set_password(std::string_view input)
constexpr std::string_view get_pathname() const noexcept ada_lifetime_bound
bool set_pathname(std::string_view input)
std::string_view get_protocol() const noexcept ada_lifetime_bound
std::string_view get_password() const noexcept ada_lifetime_bound
bool set_href(std::string_view input)
void set_search(std::string_view input)
std::string_view get_port() const noexcept ada_lifetime_bound
constexpr bool has_port() const noexcept
ada_really_inline constexpr bool has_credentials() const noexcept
bool set_host(std::string_view input)
std::string_view get_host() const noexcept ada_lifetime_bound
bool set_port(std::string_view input)
constexpr bool has_non_empty_username() const noexcept
std::string_view get_username() const noexcept ada_lifetime_bound
bool set_username(std::string_view input)
ada_really_inline constexpr bool is_special() const noexcept
static constexpr uint32_t omitted
Definitions for unicode operations.
Inline functions for url aggregator.
Declaration for the basic URL definitions.
Declaration for the URL Components.