Ada 4.1.1
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
parse.cc
Go to the documentation of this file.
1#include <fuzzer/FuzzedDataProvider.h>
2
3#include <cassert>
4#include <cstdio>
5#include <memory>
6#include <string>
7
8#include "ada.cpp"
9#include "ada.h"
10
11bool is_valid_utf8_string(const char* buf, size_t len) {
12 const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
13 uint64_t pos = 0;
14 uint32_t code_point = 0;
15 while (pos < len) {
16 uint64_t next_pos = pos + 16;
17 if (next_pos <= len) { // if it is safe to read 16 more bytes, check that
18 // they are ascii
19 uint64_t v1;
20 std::memcpy(&v1, data + pos, sizeof(uint64_t));
21 uint64_t v2;
22 std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
23 uint64_t v{v1 | v2};
24 if ((v & 0x8080808080808080) == 0) {
25 pos = next_pos;
26 continue;
27 }
28 }
29 unsigned char byte = data[pos];
30 while (byte < 0b10000000) {
31 if (++pos == len) {
32 return true;
33 }
34 byte = data[pos];
35 }
36
37 if ((byte & 0b11100000) == 0b11000000) {
38 next_pos = pos + 2;
39 if (next_pos > len) {
40 return false;
41 }
42 if ((data[pos + 1] & 0b11000000) != 0b10000000) {
43 return false;
44 }
45 code_point = (byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
46 if ((code_point < 0x80) || (0x7ff < code_point)) {
47 return false;
48 }
49 } else if ((byte & 0b11110000) == 0b11100000) {
50 next_pos = pos + 3;
51 if (next_pos > len) {
52 return false;
53 }
54 if ((data[pos + 1] & 0b11000000) != 0b10000000) {
55 return false;
56 }
57 if ((data[pos + 2] & 0b11000000) != 0b10000000) {
58 return false;
59 }
60 code_point = (byte & 0b00001111) << 12 |
61 (data[pos + 1] & 0b00111111) << 6 |
62 (data[pos + 2] & 0b00111111);
63 if ((code_point < 0x800) || (0xffff < code_point) ||
64 (0xd7ff < code_point && code_point < 0xe000)) {
65 return false;
66 }
67 } else if ((byte & 0b11111000) == 0b11110000) { // 0b11110000
68 next_pos = pos + 4;
69 if (next_pos > len) {
70 return false;
71 }
72 if ((data[pos + 1] & 0b11000000) != 0b10000000) {
73 return false;
74 }
75 if ((data[pos + 2] & 0b11000000) != 0b10000000) {
76 return false;
77 }
78 if ((data[pos + 3] & 0b11000000) != 0b10000000) {
79 return false;
80 }
81 code_point =
82 (byte & 0b00000111) << 18 | (data[pos + 1] & 0b00111111) << 12 |
83 (data[pos + 2] & 0b00111111) << 6 | (data[pos + 3] & 0b00111111);
84 if (code_point <= 0xffff || 0x10ffff < code_point) {
85 return false;
86 }
87 } else {
88 return false;
89 }
90 pos = next_pos;
91 }
92 return true;
93}
94
95// Exercise all getters and boolean predicates on ada::url
96static void exercise_url_predicates(const ada::url& u) {
97 volatile size_t length = 0;
98 length += u.get_href().size();
99 length += u.get_origin().size();
100 length += u.get_protocol().size();
101 length += u.get_username().size();
102 length += u.get_password().size();
103 length += u.get_host().size();
104 length += u.get_hostname().size();
105 length += u.get_pathname().size();
106 length += u.get_search().size();
107 length += u.get_hash().size();
108 length += u.get_port().size();
109 length += u.to_string().size();
110 length += u.get_pathname_length();
111 (void)u.has_valid_domain();
112 (void)u.has_credentials();
113 (void)u.has_empty_hostname();
114 (void)u.has_hostname();
115 (void)u.has_port();
116 (void)u.has_hash();
117 (void)u.has_search();
118 (void)u.get_components();
119}
120
121// Exercise all getters and boolean predicates on ada::url_aggregator
123 volatile size_t length = 0;
124 length += u.get_href().size();
125 length += u.get_origin().size();
126 length += u.get_protocol().size();
127 length += u.get_username().size();
128 length += u.get_password().size();
129 length += u.get_host().size();
130 length += u.get_hostname().size();
131 length += u.get_pathname().size();
132 length += u.get_search().size();
133 length += u.get_hash().size();
134 length += u.get_port().size();
135 length += u.to_string().size();
136 length += u.get_pathname_length();
137 (void)u.has_valid_domain();
138 (void)u.has_credentials();
139 (void)u.has_empty_hostname();
140 (void)u.has_hostname();
141 (void)u.has_non_empty_username();
142 (void)u.has_non_empty_password();
143 (void)u.has_password();
144 (void)u.has_port();
145 (void)u.has_hash();
146 (void)u.has_search();
147 (void)u.get_components();
148 volatile bool is_valid = u.validate();
149 (void)is_valid;
150 (void)u.to_diagram();
151}
152
153static std::string make_simple_absolute_candidate(FuzzedDataProvider& fdp) {
154 static constexpr const char* kSchemes[] = {"http://", "https://", "HTTP://",
155 "Https://", "http:", "https:"};
156 static constexpr const char* kHosts[] = {
157 "example.com",
158 "www.example.com",
159 "WWW.Example.COM",
160 "a",
161 "a.b.c",
162 "192.168.0.1",
163 "0x7f.1",
164 "127.1",
165 "xn--nxasmq6b.com",
166 "xn--a",
167 "user@example.com",
168 "user:pass@example.com",
169 "example.com:8080",
170 "example.com:0",
171 "",
172 };
173 static constexpr const char* kPaths[] = {
174 "",
175 "/",
176 "/path",
177 "/path/file.js",
178 "/a/./b/../c",
179 "/foo/%2e",
180 "/foo/%2e%2e",
181 "/path with space",
182 "/path\twith\ttab",
183 "\\path",
184 "/continue=https%3A%2F%2Fexample.com%2F",
185 };
186 static constexpr const char* kQueries[] = {
187 "",
188 "?",
189 "?q=1",
190 "?hl=en&tab=wi",
191 "?continue=https%3A%2F%2Fexample.com%2F",
192 };
193 static constexpr const char* kFrags[] = {"", "#", "#frag", "#x%20y"};
194
195 std::string out;
196 out += kSchemes[fdp.ConsumeIntegralInRange<size_t>(
197 0, sizeof(kSchemes) / sizeof(kSchemes[0]) - 1)];
198 out += kHosts[fdp.ConsumeIntegralInRange<size_t>(
199 0, sizeof(kHosts) / sizeof(kHosts[0]) - 1)];
200 out += kPaths[fdp.ConsumeIntegralInRange<size_t>(
201 0, sizeof(kPaths) / sizeof(kPaths[0]) - 1)];
202 out += kQueries[fdp.ConsumeIntegralInRange<size_t>(
203 0, sizeof(kQueries) / sizeof(kQueries[0]) - 1)];
204 out += kFrags[fdp.ConsumeIntegralInRange<size_t>(
205 0, sizeof(kFrags) / sizeof(kFrags[0]) - 1)];
206
207 if (fdp.ConsumeBool() && !out.empty()) {
208 std::string mid = fdp.ConsumeRandomLengthString(16);
209 size_t pos = fdp.ConsumeIntegralInRange<size_t>(0, out.size());
210 out.insert(pos, mid);
211 }
212 return out;
213}
214
215static void check_href_size_invariant(const ada::url& u) {
216 if (u.get_href_size() != u.get_href().size()) {
217 printf("get_href_size mismatch (url): size=%zu href.size=%zu href=%s\n",
218 u.get_href_size(), u.get_href().size(), u.get_href().c_str());
219 abort();
220 }
221}
222
224 if (u.get_href_size() != u.get_href().size()) {
225 printf(
226 "get_href_size mismatch (aggregator): size=%zu href.size=%zu href=%s\n",
227 u.get_href_size(), u.get_href().size(),
228 std::string(u.get_href()).c_str());
229 abort();
230 }
231}
232
233extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
234 FuzzedDataProvider fdp(data, size);
235 std::string source = fdp.ConsumeRandomLengthString(256);
236 std::string base = fdp.ConsumeRandomLengthString(256);
237
238 // volatile forces the compiler to store the results without undue
239 // optimizations
240 volatile size_t length = 0;
241
242 std::string simple_abs = make_simple_absolute_candidate(fdp);
243 {
244 auto su = ada::parse<ada::url>(simple_abs);
245 auto sa = ada::parse<ada::url_aggregator>(simple_abs);
246 if (su.has_value() ^ sa.has_value()) {
247 printf("simple_abs parse agreement fail: %s\n", simple_abs.c_str());
248 abort();
249 }
250 if (su) {
251 if (su->get_href() != std::string(sa->get_href())) {
252 printf("simple_abs href mismatch:\n in=%s\n url=%s\n agg=%s\n",
253 simple_abs.c_str(), su->get_href().c_str(),
254 std::string(sa->get_href()).c_str());
255 abort();
256 }
259 length += su->get_href().size();
260 }
261 }
262
263 auto parse_url = ada::parse<ada::url>(source);
264 auto parse_url_aggregator = ada::parse<ada::url_aggregator>(source);
265
266 if (is_valid_utf8_string(source.data(), source.length())) {
267 if (parse_url.has_value() ^ parse_url_aggregator.has_value()) {
268 printf("Source used to parse: %s", source.c_str());
269 abort();
270 }
271 }
272
273 if (parse_url) {
274 length += parse_url->get_href().size();
275 length += parse_url->get_origin().size();
276 check_href_size_invariant(*parse_url);
277 }
278
279 if (parse_url_aggregator) {
280 length += parse_url_aggregator->get_href().size();
281 length += parse_url_aggregator->get_origin().size();
282 check_href_size_invariant(*parse_url_aggregator);
283
284 volatile bool is_parse_url_aggregator_output_valid = false;
285 is_parse_url_aggregator_output_valid = parse_url_aggregator->validate();
286
287 assert(parse_url->get_protocol() == parse_url_aggregator->get_protocol());
288 assert(parse_url->get_href() == parse_url_aggregator->get_href());
289 assert(std::string(parse_url->get_hostname()) ==
290 std::string(parse_url_aggregator->get_hostname()));
291 assert(std::string(parse_url->get_pathname()) ==
292 std::string(parse_url_aggregator->get_pathname()));
293 assert(std::string(parse_url->get_search()) ==
294 std::string(parse_url_aggregator->get_search()));
295 assert(std::string(parse_url->get_hash()) ==
296 std::string(parse_url_aggregator->get_hash()));
297 assert(std::string(parse_url->get_port()) ==
298 std::string(parse_url_aggregator->get_port()));
299 assert(parse_url->get_username() ==
300 std::string(parse_url_aggregator->get_username()));
301 assert(parse_url->get_password() ==
302 std::string(parse_url_aggregator->get_password()));
303 assert(std::string(parse_url->get_host()) ==
304 std::string(parse_url_aggregator->get_host()));
305
306 // Exercise all predicates on both types
307 exercise_url_predicates(*parse_url);
308 exercise_aggregator_predicates(*parse_url_aggregator);
309
310 // Test set_href consistency
311 parse_url->set_href(source);
312 parse_url_aggregator->set_href(source);
313 assert(parse_url->get_href() == parse_url_aggregator->get_href());
314 }
315
319 if (parse_url) {
320 // Copy constructor
321 ada::url copied_url = *parse_url;
322 assert(copied_url.get_href() == parse_url->get_href());
323
324 // Copy assignment
325 ada::url assigned_url;
326 assigned_url = *parse_url;
327 assert(assigned_url.get_href() == parse_url->get_href());
328
329 // Move constructor
330 ada::url moved_url = std::move(copied_url);
331 assert(moved_url.get_href() == parse_url->get_href());
332 }
333
334 if (parse_url_aggregator) {
335 // Copy constructor
336 ada::url_aggregator copied_agg = *parse_url_aggregator;
337 assert(std::string(copied_agg.get_href()) ==
338 std::string(parse_url_aggregator->get_href()));
339
340 // Copy assignment
341 ada::url_aggregator assigned_agg;
342 assigned_agg = *parse_url_aggregator;
343 assert(std::string(assigned_agg.get_href()) ==
344 std::string(parse_url_aggregator->get_href()));
345
346 // Move constructor
347 ada::url_aggregator moved_agg = std::move(copied_agg);
348 assert(std::string(moved_agg.get_href()) ==
349 std::string(parse_url_aggregator->get_href()));
350
351 // Move assignment
352 ada::url_aggregator move_assigned_agg;
353 move_assigned_agg = std::move(assigned_agg);
354 assert(std::string(move_assigned_agg.get_href()) ==
355 std::string(parse_url_aggregator->get_href()));
356 }
357
361 auto out_url = ada::parse<ada::url>("https://www.ada-url.com");
362
363 if (out_url) {
364 out_url->set_protocol(source);
365 out_url->set_username(source);
366 out_url->set_password(source);
367 out_url->set_hostname(source);
368 out_url->set_host(source);
369 out_url->set_pathname(source);
370 out_url->set_search(source);
371 out_url->set_hash(source);
372 out_url->set_port(source);
373
374 // getters
375 length += out_url->get_protocol().size();
376 length += out_url->get_username().size();
377 length += out_url->get_password().size();
378 length += out_url->get_hostname().size();
379 length += out_url->get_host().size();
380 length += out_url->get_pathname().size();
381 length += out_url->get_search().size();
382 length += out_url->get_hash().size();
383 length += out_url->get_origin().size();
384 length += out_url->get_port().size();
385 length += out_url->get_pathname_length();
386
387 length += out_url->to_string().size();
388
389 // boolean predicates after setters
390 (void)out_url->has_valid_domain();
391 (void)out_url->has_credentials();
392 (void)out_url->has_empty_hostname();
393 (void)out_url->has_hostname();
394 (void)out_url->has_port();
395 (void)out_url->has_hash();
396 (void)out_url->has_search();
397 (void)out_url->get_components();
398 }
399
403 auto out_aggregator =
404 ada::parse<ada::url_aggregator>("https://www.ada-url.com");
405
406 if (out_aggregator) {
407 out_aggregator->set_protocol(source);
408 out_aggregator->set_username(source);
409 out_aggregator->set_password(source);
410 out_aggregator->set_hostname(source);
411 out_aggregator->set_host(source);
412 out_aggregator->set_pathname(source);
413 out_aggregator->set_search(source);
414 out_aggregator->set_hash(source);
415 out_aggregator->set_port(source);
416
417 // getters
418 length += out_aggregator->get_protocol().size();
419 length += out_aggregator->get_username().size();
420 length += out_aggregator->get_password().size();
421 length += out_aggregator->get_hostname().size();
422 length += out_aggregator->get_host().size();
423 length += out_aggregator->get_pathname().size();
424 length += out_aggregator->get_search().size();
425 length += out_aggregator->get_hash().size();
426 length += out_aggregator->get_origin().size();
427 length += out_aggregator->get_port().size();
428 length += out_aggregator->get_pathname_length();
429
430 length += out_aggregator->to_string().size();
431
432 volatile bool is_output_valid = false;
433 is_output_valid = out_aggregator->validate();
434
435 (void)out_aggregator->to_diagram();
436
437 // boolean predicates after setters
438 (void)out_aggregator->has_valid_domain();
439 (void)out_aggregator->has_credentials();
440 (void)out_aggregator->has_empty_hostname();
441 (void)out_aggregator->has_hostname();
442 (void)out_aggregator->has_non_empty_username();
443 (void)out_aggregator->has_non_empty_password();
444 (void)out_aggregator->has_password();
445 (void)out_aggregator->has_port();
446 (void)out_aggregator->has_hash();
447 (void)out_aggregator->has_search();
448 (void)out_aggregator->get_components();
449
450 // clear methods + postcondition assertions
451 out_aggregator->clear_port();
452 if (out_aggregator->has_port()) {
453 printf("clear_port() did not clear has_port()\n");
454 abort();
455 }
456 if (!out_aggregator->get_port().empty()) {
457 printf("clear_port() left non-empty get_port()\n");
458 abort();
459 }
460
461 out_aggregator->clear_search();
462 if (out_aggregator->has_search()) {
463 printf("clear_search() did not clear has_search()\n");
464 abort();
465 }
466 if (!out_aggregator->get_search().empty()) {
467 printf("clear_search() left non-empty get_search()\n");
468 abort();
469 }
470
471 out_aggregator->clear_hash();
472 if (out_aggregator->has_hash()) {
473 printf("clear_hash() did not clear has_hash()\n");
474 abort();
475 }
476 if (!out_aggregator->get_hash().empty()) {
477 printf("clear_hash() left non-empty get_hash()\n");
478 abort();
479 }
480 }
481
485 auto base_url = ada::parse<ada::url>(base);
486 auto base_agg = ada::parse<ada::url_aggregator>(base);
487
488 if (base_url) {
489 auto result = ada::parse<ada::url>(source, &*base_url);
490 if (result) {
491 length += result->get_href().size();
492 length += result->get_origin().size();
494 }
495 }
496
497 if (base_agg) {
498 auto result = ada::parse<ada::url_aggregator>(source, &*base_agg);
499 if (result) {
500 length += result->get_href().size();
501 length += result->get_origin().size();
503 }
504 }
505
506 // Cross-type consistency: relative URL parsing with a base should agree
507 // between url and url_aggregator representations for valid UTF-8 inputs.
508 if (is_valid_utf8_string(source.data(), source.length()) &&
509 is_valid_utf8_string(base.data(), base.length()) && base_url &&
510 base_agg) {
511 auto res_url = ada::parse<ada::url>(source, &*base_url);
512 auto res_agg = ada::parse<ada::url_aggregator>(source, &*base_agg);
513 if (res_url.has_value() ^ res_agg.has_value()) {
514 printf("Relative parse inconsistency for source=%s base=%s\n",
515 source.c_str(), base.c_str());
516 abort();
517 }
518 if (res_url && res_agg) {
519 if (res_url->get_href() != std::string(res_agg->get_href())) {
520 printf("Relative parse href mismatch for source=%s base=%s\n",
521 source.c_str(), base.c_str());
522 abort();
523 }
524 }
525 }
526
531 if (base_agg) {
532 auto level1 = ada::parse<ada::url_aggregator>(source, &*base_agg);
533 if (level1) {
534 std::string input2 = fdp.ConsumeRandomLengthString(128);
535 auto level2 = ada::parse<ada::url_aggregator>(input2, &*level1);
536 if (level2) {
537 length += level2->get_href().size();
538 volatile bool v = level2->validate();
539 (void)v;
540 }
541 }
542 }
543
549 {
550 auto known_base =
551 ada::parse<ada::url_aggregator>("https://example.com/a/b/c?query#hash");
552 if (known_base) {
553 auto result = ada::parse<ada::url_aggregator>(source, &*known_base);
554 if (result) {
555 length += result->get_href().size();
557 }
558 }
559 }
560
564 length += ada::href_from_file(source).size();
565
569 bool is_valid = ada::checkers::verify_dns_length(source);
570
571 (void)is_valid;
572
582 {
583 auto url_seq = ada::parse<ada::url>(
584 "https://user:pass@example.com:8080/path?query=1#hash");
585 auto agg_seq = ada::parse<ada::url_aggregator>(
586 "https://user:pass@example.com:8080/path?query=1#hash");
587 if (url_seq && agg_seq) {
588 int steps = fdp.ConsumeIntegralInRange(1, 8);
589 for (int i = 0; i < steps; ++i) {
590 std::string val = fdp.ConsumeRandomLengthString(64);
591 int which = fdp.ConsumeIntegralInRange(0, 8);
592 switch (which) {
593 case 0:
594 url_seq->set_protocol(val);
595 agg_seq->set_protocol(val);
596 break;
597 case 1:
598 url_seq->set_username(val);
599 agg_seq->set_username(val);
600 break;
601 case 2:
602 url_seq->set_password(val);
603 agg_seq->set_password(val);
604 break;
605 case 3:
606 url_seq->set_hostname(val);
607 agg_seq->set_hostname(val);
608 break;
609 case 4:
610 url_seq->set_host(val);
611 agg_seq->set_host(val);
612 break;
613 case 5:
614 url_seq->set_pathname(val);
615 agg_seq->set_pathname(val);
616 break;
617 case 6:
618 url_seq->set_search(val);
619 agg_seq->set_search(val);
620 break;
621 case 7:
622 url_seq->set_hash(val);
623 agg_seq->set_hash(val);
624 break;
625 case 8:
626 url_seq->set_port(val);
627 agg_seq->set_port(val);
628 break;
629 }
630 // After every setter both representations must agree on href.
631 if (url_seq->get_href() != std::string(agg_seq->get_href())) {
632 printf(
633 "Sequential setter href mismatch after setter=%d val='%s'\n"
634 " url: %s\n agg: %s\n",
635 which, val.c_str(), url_seq->get_href().c_str(),
636 std::string(agg_seq->get_href()).c_str());
637 abort();
638 }
639 // url_aggregator internal invariant must still hold.
640 volatile bool v = agg_seq->validate();
641 (void)v;
642 }
643 }
644 }
645
653 if (parse_url_aggregator) {
654 std::string href1 = std::string(parse_url_aggregator->get_href());
655 auto reparsed = ada::parse<ada::url_aggregator>(href1);
656 if (!reparsed) {
657 printf("Re-parse of href failed unexpectedly: '%s'\n", href1.c_str());
658 abort();
659 }
660 std::string href2 = std::string(reparsed->get_href());
661 if (href1 != href2) {
662 printf(
663 "Re-parse idempotency failure!\n"
664 " href1: %s\n href2: %s\n",
665 href1.c_str(), href2.c_str());
666 abort();
667 }
668 }
669
681 {
682 std::string search_url = "https://example.com/?" + source;
683 auto url_with_search = ada::parse<ada::url_aggregator>(search_url);
684 if (url_with_search) {
685 // Extract the search string (may include leading '?').
686 std::string search_raw = std::string(url_with_search->get_search());
687 std::string_view search_view = search_raw;
688 if (!search_view.empty() && search_view[0] == '?') {
689 search_view = search_view.substr(1);
690 }
691
692 ada::url_search_params sp(search_view);
693
694 // Mutate with additional entries from the fuzz corpus.
695 sp.append(source, base);
696
697 std::string serialized = sp.to_string();
698
699 // Idempotency: re-parsing the serialised form must yield the same string.
700 ada::url_search_params sp2(serialized);
701 std::string serialized2 = sp2.to_string();
702 if (serialized2 != serialized) {
703 printf(
704 "url_search_params serialisation not idempotent!\n"
705 " first: %s\n second: %s\n",
706 serialized.c_str(), serialized2.c_str());
707 abort();
708 }
709
710 // Set the serialised params back on the URL.
711 url_with_search->set_search(serialized);
712 volatile bool v = url_with_search->validate();
713 (void)v;
714 }
715 }
716
717 return 0;
718} // extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
Main header for the Ada URL parser library.
std::string href_from_file(std::string_view path)
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
bool is_valid_utf8_string(const char *buf, size_t len)
Definition parse.cc:11
static void exercise_url_predicates(const ada::url &u)
Definition parse.cc:96
static void exercise_aggregator_predicates(const ada::url_aggregator &u)
Definition parse.cc:122
static void check_href_size_invariant(const ada::url &u)
Definition parse.cc:215
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Definition parse.cc:233
static std::string make_simple_absolute_candidate(FuzzedDataProvider &fdp)
Definition parse.cc:153
static constexpr const char * kPaths[]
static constexpr const char * kFrags[]
static constexpr const char * kSchemes[]
static constexpr const char * kHosts[]
static constexpr const char * kQueries[]
Memory-efficient URL representation using a single buffer.
ada_really_inline const url_components & get_components() const noexcept
constexpr bool has_non_empty_password() const noexcept
constexpr size_t get_href_size() const noexcept
constexpr bool validate() const noexcept
std::string_view get_search() const ada_lifetime_bound
std::string_view get_hash() const ada_lifetime_bound
std::string to_string() const override
std::string_view get_password() const ada_lifetime_bound
std::string_view get_host() const ada_lifetime_bound
std::string_view get_username() const ada_lifetime_bound
std::string_view get_port() const ada_lifetime_bound
std::string to_diagram() const
constexpr bool has_hostname() const noexcept
constexpr bool has_search() const noexcept override
std::string get_origin() const override
constexpr std::string_view get_href() const noexcept ada_lifetime_bound
constexpr bool has_empty_hostname() const noexcept
constexpr bool has_password() const noexcept
ada_really_inline uint32_t get_pathname_length() const noexcept
bool has_valid_domain() const noexcept override
constexpr bool has_hash() const noexcept override
constexpr std::string_view get_pathname() const ada_lifetime_bound
std::string_view get_hostname() const ada_lifetime_bound
std::string_view get_protocol() const ada_lifetime_bound
constexpr bool has_port() const noexcept
ada_really_inline constexpr bool has_credentials() const noexcept
constexpr bool has_non_empty_username() const noexcept
Class for parsing and manipulating URL query strings.
std::string to_string() const
void append(std::string_view key, std::string_view value)
Represents a parsed URL with individual string components.
Definition url.h:64
bool has_empty_hostname() const noexcept
Definition url-inl.h:34
bool has_port() const noexcept
Definition url-inl.h:28
ada_really_inline bool has_credentials() const noexcept
Definition url-inl.h:25
ada_really_inline size_t get_pathname_length() const noexcept
Definition url-inl.h:47
std::string get_search() const
Definition url.cpp:591
std::string get_port() const
Definition url.cpp:605
std::string get_protocol() const
Definition url.cpp:565
bool has_hostname() const noexcept
Definition url-inl.h:40
std::string get_host() const
Definition url.cpp:573
constexpr std::string_view get_pathname() const noexcept
Definition url-inl.h:51
size_t get_href_size() const noexcept
Definition url-inl.h:283
std::string get_hostname() const
Definition url.cpp:587
ada_really_inline std::string get_href() const
Definition url-inl.h:196
std::string get_origin() const override
Definition url.cpp:539
const std::string & get_password() const noexcept
Definition url.cpp:601
ada_really_inline ada::url_components get_components() const
Definition url-inl.h:55
const std::string & get_username() const noexcept
Definition url.cpp:597
constexpr bool has_search() const noexcept override
Definition url-inl.h:172
std::string to_string() const override
Definition url.cpp:482
std::string get_hash() const
Definition url.cpp:609
constexpr bool has_hash() const noexcept override
Definition url-inl.h:168
bool has_valid_domain() const noexcept override
Definition url.cpp:532