|
Ada 3.4.4
Fast spec-compliant URL parser
|
Namespaces | |
| namespace | character_sets |
| Includes the definitions for unicode character sets. | |
| namespace | checkers |
| Includes the definitions for validation functions. | |
| namespace | helpers |
| Includes the definitions for helper functions. | |
| namespace | idna |
| namespace | parser |
| Internal URL parsing implementation. | |
| namespace | scheme |
| URL scheme utilities and constants. | |
| namespace | serializers |
| IP address serialization functions. | |
| namespace | unicode |
| Includes the declarations for unicode operations. | |
Classes | |
| struct | url |
| Represents a parsed URL with individual string components. More... | |
| struct | url_aggregator |
| Memory-efficient URL representation using a single buffer. More... | |
| struct | url_base |
| Abstract base class for URL representations. More... | |
| struct | url_components |
| Stores byte offsets for URL components within a buffer. More... | |
| struct | url_search_params |
| Class for parsing and manipulating URL query strings. More... | |
| struct | url_search_params_iter |
| JavaScript-style iterator for url_search_params. More... | |
Typedefs | |
| template<class result_type = ada::url_aggregator> | |
| using | result = tl::expected< result_type, ada::errors > |
| typedef std::pair< std::string_view, std::string_view > | key_value_view_pair |
| using | url_search_params_keys_iter = url_search_params_iter< std::string_view, url_search_params_iter_type::KEYS > |
| using | url_search_params_values_iter = url_search_params_iter< std::string_view, url_search_params_iter_type::VALUES > |
| using | url_search_params_entries_iter = url_search_params_iter< key_value_view_pair, url_search_params_iter_type::ENTRIES > |
Enumerations | |
| enum | { ADA_VERSION_MAJOR = 3 , ADA_VERSION_MINOR = 4 , ADA_VERSION_REVISION = 4 } |
| enum class | encoding_type { UTF8 , UTF_16LE , UTF_16BE } |
| Character encoding types for URL processing. More... | |
| enum class | errors : uint8_t { type_error } |
| Error codes for URL parsing operations. More... | |
| enum class | state { AUTHORITY , SCHEME_START , SCHEME , HOST , NO_SCHEME , FRAGMENT , RELATIVE_SCHEME , RELATIVE_SLASH , FILE , FILE_HOST , FILE_SLASH , PATH_OR_AUTHORITY , SPECIAL_AUTHORITY_IGNORE_SLASHES , SPECIAL_AUTHORITY_SLASHES , SPECIAL_RELATIVE_OR_AUTHORITY , QUERY , PATH , PATH_START , OPAQUE_PATH , PORT } |
| States in the URL parsing state machine. More... | |
| enum | url_host_type : uint8_t { DEFAULT = 0 , IPV4 = 1 , IPV6 = 2 } |
| Enum representing the type of host in a URL. More... | |
| enum class | url_search_params_iter_type { KEYS , VALUES , ENTRIES } |
| Iterator types for url_search_params iteration. More... | |
Functions | |
| void | unreachable () |
| ada_warn_unused std::string_view | to_string (encoding_type type) |
| template<class result_type = ada::url_aggregator> | |
| ada_warn_unused ada::result< result_type > | parse (std::string_view input, const result_type *base_url=nullptr) |
| template ada::result< url > | parse< url > (std::string_view input, const url *base_url) |
| template ada::result< url_aggregator > | parse< url_aggregator > (std::string_view input, const url_aggregator *base_url) |
| bool | can_parse (std::string_view input, const std::string_view *base_input=nullptr) |
| std::string | href_from_file (std::string_view path) |
| ada_warn_unused std::string | to_string (ada::state s) |
| std::ostream & | operator<< (std::ostream &out, const ada::url &u) |
| std::ostream & | operator<< (std::ostream &out, const ada::url_aggregator &u) |
| template<class result_type > | |
| ada_warn_unused tl::expected< result_type, errors > | parse (std::string_view input, const result_type *base_url) |
Forward declarations
| typedef std::pair<std::string_view, std::string_view> ada::key_value_view_pair |
Type alias for a key-value pair of string views.
Definition at line 34 of file url_search_params.h.
| using ada::result = typedef tl::expected<result_type, ada::errors> |
Definition at line 44 of file implementation.h.
| using ada::url_search_params_entries_iter = typedef url_search_params_iter<key_value_view_pair, url_search_params_iter_type::ENTRIES> |
Iterator over search parameter key-value pairs.
Definition at line 44 of file url_search_params.h.
| using ada::url_search_params_keys_iter = typedef url_search_params_iter<std::string_view, url_search_params_iter_type::KEYS> |
Iterator over search parameter keys.
Definition at line 37 of file url_search_params.h.
| using ada::url_search_params_values_iter = typedef url_search_params_iter<std::string_view, url_search_params_iter_type::VALUES> |
Iterator over search parameter values.
Definition at line 40 of file url_search_params.h.
| Enumerator | |
|---|---|
| ADA_VERSION_MAJOR | |
| ADA_VERSION_MINOR | |
| ADA_VERSION_REVISION | |
Definition at line 12 of file ada_version.h.
|
strong |
Character encoding types for URL processing.
Specifies the character encoding used for percent-decoding and other string operations. UTF-8 is the most commonly used encoding for URLs.
| Enumerator | |
|---|---|
| UTF8 | UTF-8 encoding (default for URLs) |
| UTF_16LE | UTF-16 Little Endian encoding |
| UTF_16BE | UTF-16 Big Endian encoding |
Definition at line 25 of file encoding_type.h.
|
strong |
|
strong |
States in the URL parsing state machine.
The URL parser processes input through a sequence of states, each handling a specific part of the URL syntax.
Enum representing the type of host in a URL.
Used to distinguish between regular domain names, IPv4 addresses, and IPv6 addresses for proper parsing and serialization.
| Enumerator | |
|---|---|
| DEFAULT | Regular domain name (e.g., "www.example.com") |
| IPV4 | IPv4 address (e.g., "127.0.0.1") |
| IPV6 | IPv6 address (e.g., "[::1]" or "[2001:db8::1]") |
Definition at line 26 of file url_base.h.
Iterator types for url_search_params iteration.
| Enumerator | |
|---|---|
| KEYS | Iterate over parameter keys only |
| VALUES | Iterate over parameter values only |
| ENTRIES | Iterate over key-value pairs |
Definition at line 24 of file url_search_params.h.
Definition at line 51 of file implementation.cpp.
References parse().
Referenced by ada_can_parse(), ada_can_parse_with_base(), and LLVMFuzzerTestOneInput().
| std::string ada::href_from_file | ( | std::string_view | path | ) |
Converts a file system path to a file:// URL.
Creates a properly formatted file URL from a local file system path. Handles platform-specific path separators and percent-encoding.
| path | The file system path to convert. Must be valid ASCII or UTF-8. |
Definition at line 28 of file implementation.cpp.
References ada::scheme::FILE, and parse().
Referenced by LLVMFuzzerTestOneInput().
|
inline |
|
inline |
Definition at line 1109 of file url_aggregator-inl.h.
References parse().
| ada_warn_unused tl::expected< result_type, errors > ada::parse | ( | std::string_view | input, |
| const result_type * | base_url | ||
| ) |
Definition at line 13 of file implementation.cpp.
References parse(), and type_error.
Referenced by ada_copy(), ada_parse(), ada_parse_search_params(), ada_parse_with_base(), ada_search_params_get_entries(), ada_search_params_get_keys(), ada_search_params_get_values(), ada::idna::adapt(), ada::idna::ascii_map(), ada::character_sets::bit_at(), ada::scheme::details::branchless_load5(), ada::unicode::broadcast(), can_parse(), ada::url_components::check_offset_consistency(), ada::url_aggregator::clear_hash(), ada::url_aggregator::clear_port(), ada::url_aggregator::clear_search(), ada::idna::compose(), ada::idna::compute_decomposition_length(), ada::idna::contains_forbidden_domain_code_point(), ada::idna::decompose(), ada::idna::decompose_nfc(), ada::idna::digit_to_char(), exercise_exec_and_test(), ada::idna::find_direction(), ada::idna::find_last_not_of_nsm(), ada::serializers::find_longest_sequence_of_ipv6_pieces(), ada::helpers::find_next_host_delimiter(), ada::helpers::find_next_host_delimiter_special(), ada::idna::find_range_index(), ada::idna::from_ascii_to_ascii(), ada::url_search_params::get(), ada::url_search_params::get_all(), ada::idna::get_ccc(), ada::url::get_components(), ada::url_aggregator::get_hash(), ada::url_aggregator::get_host(), ada::url_aggregator::get_hostname(), ada::url::get_href(), ada::url_aggregator::get_href(), ada::url::get_origin(), ada::url_aggregator::get_origin(), ada::url_aggregator::get_password(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_port(), ada::url_aggregator::get_protocol(), ada::scheme::get_scheme_type(), ada::url_aggregator::get_search(), ada::scheme::get_special_port(), ada::scheme::get_special_port(), ada::helpers::get_state(), ada::url_aggregator::get_username(), ada::url_search_params::has(), ada::url_search_params::has(), ada::url_aggregator::has_credentials(), ada::url_aggregator::has_hash(), ada::checkers::has_hex_prefix(), ada::checkers::has_hex_prefix_unsafe(), ada::url_aggregator::has_non_empty_password(), ada::url_aggregator::has_non_empty_username(), ada::url_aggregator::has_password(), ada::url_aggregator::has_port(), ada::url_aggregator::has_search(), ada::url_base::has_valid_domain(), href_from_file(), ada::serializers::ipv4(), ada::serializers::ipv6(), ada::checkers::is_alpha(), ada::idna::is_ascii(), ada::idna::is_ascii(), ada::idna::is_ascii_letter(), ada::idna::is_ascii_letter_or_digit(), ada::checkers::is_digit(), ada::idna::is_forbidden_domain_code_point(), ada::idna::is_label_valid(), ada::checkers::is_normalized_windows_drive_letter(), ada::idna::is_rtl_label(), ada::unicode::is_tabs_or_newline(), ada::checkers::is_windows_drive_letter(), LLVMFuzzerTestOneInput(), ada::scheme::details::make_key(), ada::idna::map(), ada::idna::normalize(), operator<<(), operator<<(), parse(), ada::parser::parse_url(), ada::parser::parse_url_impl(), ada::unicode::percent_encode_index(), ada::idna::punycode_to_utf32(), ada::url_search_params::remove(), ada::url_search_params::remove(), ada::url_search_params::set(), ada::url::set_hash(), ada::url_aggregator::set_hash(), ada::url::set_host(), ada::url_aggregator::set_host(), ada::url::set_hostname(), ada::url_aggregator::set_hostname(), ada::url::set_href(), ada::url_aggregator::set_href(), ada::url::set_password(), ada::url_aggregator::set_password(), ada::url::set_pathname(), ada::url_aggregator::set_pathname(), ada::url::set_port(), ada::url_aggregator::set_port(), ada::url::set_protocol(), ada::url_aggregator::set_protocol(), ada::url::set_search(), ada::url_aggregator::set_search(), ada::url::set_username(), ada::url_aggregator::set_username(), ada::url_search_params::sort(), ada::idna::sort_marks(), ada::idna::to_ascii(), ada::url_aggregator::to_diagram(), ada::checkers::to_lower(), ada::url_components::to_string(), ada::url_search_params::to_string(), ada::url::to_string(), ada::url_aggregator::to_string(), ada::idna::to_unicode(), ada::helpers::trailing_zeroes(), ada::checkers::try_parse_ipv4_fast(), unreachable(), ada::url_search_params::url_search_params(), ada::idna::utf32_length_from_utf8(), ada::idna::utf32_to_punycode(), ada::idna::utf32_to_utf8(), ada::idna::utf8_length_from_utf32(), ada::idna::utf8_to_utf32(), ada::idna::valid_name_code_point(), ada::url_aggregator::validate(), and ada::idna::verify_punycode().
| ada_warn_unused ada::result< result_type > ada::parse | ( | std::string_view | input, |
| const result_type * | base_url = nullptr |
||
| ) |
Definition at line 13 of file implementation.cpp.
References parse(), and type_error.
Referenced by ada_copy(), ada_parse(), ada_parse_search_params(), ada_parse_with_base(), ada_search_params_get_entries(), ada_search_params_get_keys(), ada_search_params_get_values(), ada::idna::adapt(), ada::idna::ascii_map(), ada::character_sets::bit_at(), ada::scheme::details::branchless_load5(), ada::unicode::broadcast(), can_parse(), ada::url_components::check_offset_consistency(), ada::url_aggregator::clear_hash(), ada::url_aggregator::clear_port(), ada::url_aggregator::clear_search(), ada::idna::compose(), ada::idna::compute_decomposition_length(), ada::idna::contains_forbidden_domain_code_point(), ada::idna::decompose(), ada::idna::decompose_nfc(), ada::idna::digit_to_char(), exercise_exec_and_test(), ada::idna::find_direction(), ada::idna::find_last_not_of_nsm(), ada::serializers::find_longest_sequence_of_ipv6_pieces(), ada::helpers::find_next_host_delimiter(), ada::helpers::find_next_host_delimiter_special(), ada::idna::find_range_index(), ada::idna::from_ascii_to_ascii(), ada::url_search_params::get(), ada::url_search_params::get_all(), ada::idna::get_ccc(), ada::url::get_components(), ada::url_aggregator::get_hash(), ada::url_aggregator::get_host(), ada::url_aggregator::get_hostname(), ada::url::get_href(), ada::url_aggregator::get_href(), ada::url::get_origin(), ada::url_aggregator::get_origin(), ada::url_aggregator::get_password(), ada::url_aggregator::get_pathname(), ada::url_aggregator::get_pathname_length(), ada::url_aggregator::get_port(), ada::url_aggregator::get_protocol(), ada::scheme::get_scheme_type(), ada::url_aggregator::get_search(), ada::scheme::get_special_port(), ada::scheme::get_special_port(), ada::helpers::get_state(), ada::url_aggregator::get_username(), ada::url_search_params::has(), ada::url_search_params::has(), ada::url_aggregator::has_credentials(), ada::url_aggregator::has_hash(), ada::checkers::has_hex_prefix(), ada::checkers::has_hex_prefix_unsafe(), ada::url_aggregator::has_non_empty_password(), ada::url_aggregator::has_non_empty_username(), ada::url_aggregator::has_password(), ada::url_aggregator::has_port(), ada::url_aggregator::has_search(), ada::url_base::has_valid_domain(), href_from_file(), ada::serializers::ipv4(), ada::serializers::ipv6(), ada::checkers::is_alpha(), ada::idna::is_ascii(), ada::idna::is_ascii(), ada::idna::is_ascii_letter(), ada::idna::is_ascii_letter_or_digit(), ada::checkers::is_digit(), ada::idna::is_forbidden_domain_code_point(), ada::idna::is_label_valid(), ada::checkers::is_normalized_windows_drive_letter(), ada::idna::is_rtl_label(), ada::unicode::is_tabs_or_newline(), ada::checkers::is_windows_drive_letter(), LLVMFuzzerTestOneInput(), ada::scheme::details::make_key(), ada::idna::map(), ada::idna::normalize(), operator<<(), operator<<(), parse(), ada::parser::parse_url(), ada::parser::parse_url_impl(), ada::unicode::percent_encode_index(), ada::idna::punycode_to_utf32(), ada::url_search_params::remove(), ada::url_search_params::remove(), ada::url_search_params::set(), ada::url::set_hash(), ada::url_aggregator::set_hash(), ada::url::set_host(), ada::url_aggregator::set_host(), ada::url::set_hostname(), ada::url_aggregator::set_hostname(), ada::url::set_href(), ada::url_aggregator::set_href(), ada::url::set_password(), ada::url_aggregator::set_password(), ada::url::set_pathname(), ada::url_aggregator::set_pathname(), ada::url::set_port(), ada::url_aggregator::set_port(), ada::url::set_protocol(), ada::url_aggregator::set_protocol(), ada::url::set_search(), ada::url_aggregator::set_search(), ada::url::set_username(), ada::url_aggregator::set_username(), ada::url_search_params::sort(), ada::idna::sort_marks(), ada::idna::to_ascii(), ada::url_aggregator::to_diagram(), ada::checkers::to_lower(), ada::url_components::to_string(), ada::url_search_params::to_string(), ada::url::to_string(), ada::url_aggregator::to_string(), ada::idna::to_unicode(), ada::helpers::trailing_zeroes(), ada::checkers::try_parse_ipv4_fast(), unreachable(), ada::url_search_params::url_search_params(), ada::idna::utf32_length_from_utf8(), ada::idna::utf32_to_punycode(), ada::idna::utf32_to_utf8(), ada::idna::utf8_length_from_utf32(), ada::idna::utf8_to_utf32(), ada::idna::valid_name_code_point(), ada::url_aggregator::validate(), and ada::idna::verify_punycode().
|
extern |
|
extern |
Referenced by ada::url_aggregator::set_href().
| ada_warn_unused std::string ada::to_string | ( | ada::state | s | ) |
Converts a parser state to its string name for debugging.
| s | The state to convert. |
Definition at line 1063 of file helpers.cpp.
References ada::helpers::get_state().
| ada_warn_unused std::string_view ada::to_string | ( | ada::encoding_type | type | ) |
Converts an encoding_type to its string representation.
| type | The encoding type to convert. |
Definition at line 70 of file implementation.cpp.
References unreachable(), UTF8, UTF_16BE, and UTF_16LE.
Referenced by ada::parser::parse_url_impl().
|
inline |
Definition at line 161 of file common_defs.h.
References parse().
Referenced by ada::parser::parse_url_impl(), and to_string().