• Home
Name Date Size #Lines LOC

..--

android/04-Jul-2025-2,0551,459

ipc/04-Jul-2025-281189

mojom/04-Jul-2025-534369

third_party/mozilla/04-Jul-2025-1,7671,056

Android.bpD04-Jul-202517.7 KiB456450

DEPSD04-Jul-2025385 2018

DIR_METADATAD04-Jul-202589 76

README.mdD04-Jul-20254.1 KiB9268

gurl.ccD04-Jul-202516.9 KiB563413

gurl.hD04-Jul-202522.4 KiB544195

gurl_abstract_tests.hD04-Jul-20255.2 KiB12085

gurl_fuzzer.ccD04-Jul-20253.2 KiB9571

gurl_fuzzer.dictD04-Jul-20253.8 KiB433428

gurl_unittest.ccD04-Jul-202555 KiB1,5351,178

origin.ccD04-Jul-202516.2 KiB506335

origin.hD04-Jul-202521.5 KiB529202

origin_abstract_tests.ccD04-Jul-20253 KiB10567

origin_abstract_tests.hD04-Jul-202523.9 KiB621435

origin_unittest.ccD04-Jul-202536.7 KiB912680

run_all_perftests.ccD04-Jul-2025486 159

run_all_unittests.ccD04-Jul-2025698 2818

scheme_host_port.ccD04-Jul-202510 KiB322219

scheme_host_port.hD04-Jul-20257.1 KiB18351

scheme_host_port_unittest.ccD04-Jul-202511.1 KiB305250

url_canon.ccD04-Jul-2025416 167

url_canon.hD04-Jul-202549 KiB1,207688

url_canon_etc.ccD04-Jul-202516.9 KiB434293

url_canon_filesystemurl.ccD04-Jul-20255.2 KiB13298

url_canon_fileurl.ccD04-Jul-20259.1 KiB256171

url_canon_host.ccD04-Jul-202528.9 KiB754516

url_canon_icu.ccD04-Jul-20254 KiB12181

url_canon_icu.hD04-Jul-20251.2 KiB4119

url_canon_icu_fuzzer.ccD04-Jul-2025709 2818

url_canon_icu_test_helpers.hD04-Jul-20251 KiB4227

url_canon_icu_unittest.ccD04-Jul-20254.6 KiB149106

url_canon_internal.ccD04-Jul-202521.1 KiB507401

url_canon_internal.hD04-Jul-202520.2 KiB486236

url_canon_internal_file.hD04-Jul-20255.5 KiB13666

url_canon_ip.ccD04-Jul-202524.4 KiB710418

url_canon_ip.hD04-Jul-20252.3 KiB6130

url_canon_mailtourl.ccD04-Jul-20254.6 KiB13395

url_canon_non_special_url.ccD04-Jul-20259.6 KiB260139

url_canon_path.ccD04-Jul-202517.8 KiB413239

url_canon_pathurl.ccD04-Jul-20255.7 KiB151104

url_canon_query.ccD04-Jul-20256.1 KiB15487

url_canon_relative.ccD04-Jul-202529.3 KiB719412

url_canon_stdstring.ccD04-Jul-2025766 3119

url_canon_stdstring.hD04-Jul-20254.8 KiB13374

url_canon_stdurl.ccD04-Jul-20257.8 KiB218154

url_canon_unittest.ccD04-Jul-2025139.4 KiB3,2902,420

url_constants.hD04-Jul-20253.2 KiB7558

url_features.ccD04-Jul-20252 KiB5635

url_features.hD04-Jul-20251.5 KiB4315

url_file.hD04-Jul-20253.7 KiB9857

url_idna_icu.ccD04-Jul-20255.3 KiB14769

url_idna_icu_alternatives_android.ccD04-Jul-20251.3 KiB4224

url_idna_icu_alternatives_ios.mmD04-Jul-2025722 2922

url_idna_icu_fuzzer.ccD04-Jul-2025742 3220

url_parse_file.ccD04-Jul-20258 KiB20299

url_parse_internal.hD04-Jul-20255.9 KiB15686

url_parse_perftest.ccD04-Jul-20254 KiB12397

url_parse_unittest.ccD04-Jul-202537.1 KiB743527

url_test_utils.hD04-Jul-20251.2 KiB4522

url_util.ccD04-Jul-202537.4 KiB1,003715

url_util.hD04-Jul-202514.4 KiB333153

url_util_internal.hD04-Jul-2025757 2412

url_util_unittest.ccD04-Jul-202534.6 KiB922688

README.md

1# Chrome's URL library
2
3## Layers
4
5There are several conceptual layers in this directory. Going from the lowest
6level up, they are:
7
8### Parsing
9
10The `url_parse.*` files are the parser. This code does no string
11transformations. Its only job is to take an input string and split out the
12components of the URL as best as it can deduce them, for a given type of URL.
13Parsing can never fail, it will take its best guess. This layer does not
14have logic for determining the type of URL parsing to apply, that needs to
15be applied at a higher layer (the "util" layer below).
16
17Because the parser code is derived (_very_ distantly) from some code in
18Mozilla, some of the parser files are in `url/third_party/mozilla/`.
19
20The main header to include for calling the parser is
21`url/third_party/mozilla/url_parse.h`.
22
23### Canonicalization
24
25The `url_canon*` files are the canonicalizer. This code will transform specific
26URL components or specific types of URLs into a standard form. For some
27dangerous or invalid data, the canonicalizer will report that a URL is invalid,
28although it will always try its best to produce output (so the calling code
29can, for example, show the user an error that the URL is invalid). The
30canonicalizer attempts to provide as consistent a representation as possible
31without changing the meaning of a URL.
32
33The canonicalizer layer is designed to be independent of the string type of
34the embedder, so all string output is done through a `CanonOutput` wrapper
35object. An implementation for `std::string` output is provided in
36`url_canon_stdstring.h`.
37
38The main header to include for calling the canonicalizer is
39`url/url_canon.h`.
40
41### Utility
42
43The `url_util*` files provide a higher-level wrapper around the parser and
44canonicalizer. While it can be called directly, it is designed to be the
45foundation for writing URL wrapper objects (The GURL later and Blink's KURL
46object use the Utility layer to implement the low-level logic).
47
48The Utility code makes decisions about URL types and calls the correct parsing
49and canonicalzation functions for those types. It provides an interface to
50register application-specific schemes that have specific requirements.
51Sharing this loigic between KURL and GURL is important so that URLs are
52handled consistently across the application.
53
54The main header to include is `url/url_util.h`.
55
56### Google URL (GURL) and Origin
57
58At the highest layer, a C++ object for representing URLs is provided. This
59object uses STL. Most uses need only this layer. Include `url/gurl.h`.
60
61Also at this layer is also the Origin object which exists to make security
62decisions on the web. Include `url/origin.h`.
63
64## Historical background
65
66This code was originally a separate library that was designed to be embedded
67into both Chrome (which uses STL) and WebKit (which didn't use any STL at the
68time). As a result, the parsing, canonicalization, and utility code could
69not use STL, or any other common code in Chromium like base.
70
71When WebKit was forked into the Chromium repo and renamed Blink, this
72restriction has been relaxed somewhat. Blink still provides its own URL object
73using its own string type, so the insulation that the Utility layer provides is
74still useful. But some STL strings and calls to base functions have gradually
75been added in places where doing so is possible.
76
77## Caution for terminologies
78
79Due to historical usage, the term "Standard URL" is currently used within the
80code to represent "[Special URLs][1]", except for "file:" scheme URL, as defined
81in the URL Standard. However, this terminology is outdated and can lead to
82confusion, particularly now that we are supporting [non-special URLs][2] as well
83([crbug/1416006][3]). For the sake of consistency and clarity, it is recommended
84to switch to the more accurate term "Special URL" throughout the codebase.
85However, this change should be carefully planned and executed due to the
86widespread use of the current terminology in both internal and third-party code.
87For a while, "Standard URL" and "Special URL" are used interchangeably.
88
89[1]: https://url.spec.whatwg.org/#is-special
90[2]: https://url.spec.whatwg.org/#is-not-special
91[3]: https://crbug.com/1416006
92