From c315c8312524cde52ea12a2168bc3e7760de40dd Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 27 Aug 2023 00:22:38 +0000 Subject: [PATCH 1/5] deps: update ada to 2.6.3 --- deps/ada/ada.cpp | 20 ++- deps/ada/ada.h | 143 ++++++++++++++++-- deps/ada/ada_c.h | 2 + .../maintaining/maintaining-dependencies.md | 6 +- 4 files changed, 152 insertions(+), 19 deletions(-) diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp index ce4e6302acbe87..35f83eae9af00f 100644 --- a/deps/ada/ada.cpp +++ b/deps/ada/ada.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */ +/* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */ /* begin file src/ada.cpp */ #include "ada.h" /* begin file src/checkers.cpp */ @@ -11231,6 +11231,7 @@ bool url::parse_ipv4(std::string_view input) { } else { host = ada::serializers::ipv4(ipv4); // We have to reserialize the address. } + host_type = IPV4; return true; } @@ -11460,6 +11461,7 @@ bool url::parse_ipv6(std::string_view input) { } host = ada::serializers::ipv6(address); ada_log("parse_ipv6 ", *host); + host_type = IPV6; return true; } @@ -12569,7 +12571,6 @@ result_type parse_url(std::string_view user_input, // If c is U+002F (/) and remaining starts with U+002F (/), // then set state to special authority ignore slashes state and increase // pointer by 1. - state = ada::state::SPECIAL_AUTHORITY_IGNORE_SLASHES; std::string_view view = helpers::substring(url_data, input_position); if (ada::checkers::begins_with(view, "//")) { input_position += 2; @@ -14021,6 +14022,7 @@ bool url_aggregator::parse_ipv4(std::string_view input) { update_base_hostname( ada::serializers::ipv4(ipv4)); // We have to reserialize the address. } + host_type = IPV4; ADA_ASSERT_TRUE(validate()); return true; } @@ -14256,6 +14258,7 @@ bool url_aggregator::parse_ipv6(std::string_view input) { update_base_hostname(ada::serializers::ipv6(address)); ada_log("parse_ipv6 ", get_hostname()); ADA_ASSERT_TRUE(validate()); + host_type = IPV6; return true; } @@ -14890,6 +14893,11 @@ void ada_free(ada_url result) noexcept { delete r; } +ada_url ada_copy(ada_url input) noexcept { + ada::result& r = get_instance(input); + return new ada::result(r); +} + bool ada_is_valid(ada_url result) noexcept { ada::result& r = get_instance(result); return r.has_value(); @@ -15007,6 +15015,14 @@ ada_string ada_get_protocol(ada_url result) noexcept { return ada_string_create(out.data(), out.length()); } +uint8_t ada_get_url_host_type(ada_url result) noexcept { + ada::result& r = get_instance(result); + if (!r) { + return 0; + } + return r->host_type; +} + bool ada_set_href(ada_url result, const char* input, size_t length) noexcept { ada::result& r = get_instance(result); if (!r) { diff --git a/deps/ada/ada.h b/deps/ada/ada.h index 3f1531944e96e7..caceff37d56121 100644 --- a/deps/ada/ada.h +++ b/deps/ada/ada.h @@ -1,4 +1,4 @@ -/* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */ +/* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */ /* begin file include/ada.h */ /** * @file ada.h @@ -1008,6 +1008,7 @@ ada_really_inline bool bit_at(const uint8_t a[], const uint8_t i) { #define ADA_CHECKERS_INL_H +#include #include #include @@ -1058,7 +1059,7 @@ ada_really_inline constexpr bool begins_with(std::string_view view, std::string_view prefix) { // in C++20, you have view.begins_with(prefix) return view.size() >= prefix.size() && - (view.substr(0, prefix.size()) == prefix); + std::equal(prefix.begin(), prefix.end(), view.begin()); } } // namespace ada::checkers @@ -1406,6 +1407,25 @@ constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept; namespace ada { +/** + * Type of URL host as an enum. + */ +enum url_host_type : uint8_t { + /** + * Represents common URLs such as "https://www.google.com" + */ + DEFAULT = 0, + /** + * Represents ipv4 addresses such as "http://127.0.0.1" + */ + IPV4 = 1, + /** + * Represents ipv6 addresses such as + * "http://[2001:db8:3333:4444:5555:6666:7777:8888]" + */ + IPV6 = 2, +}; + /** * @brief Base class of URL implementations * @@ -1428,6 +1448,11 @@ struct url_base { */ bool has_opaque_path{false}; + /** + * URL hosts type + */ + url_host_type host_type = url_host_type::DEFAULT; + /** * @private */ @@ -1768,8 +1793,8 @@ inline int fast_digit_count(uint32_t x) noexcept { #define TL_EXPECTED_HPP #define TL_EXPECTED_VERSION_MAJOR 1 -#define TL_EXPECTED_VERSION_MINOR 0 -#define TL_EXPECTED_VERSION_PATCH 1 +#define TL_EXPECTED_VERSION_MINOR 1 +#define TL_EXPECTED_VERSION_PATCH 0 #include #include @@ -1802,6 +1827,16 @@ inline int fast_digit_count(uint32_t x) noexcept { #define TL_EXPECTED_GCC55 #endif +#if !defined(TL_ASSERT) +// can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug +#if (__cplusplus > 201103L) && !defined(TL_EXPECTED_GCC49) +#include +#define TL_ASSERT(x) assert(x) +#else +#define TL_ASSERT(x) +#endif +#endif + #if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \ !defined(__clang__)) // GCC < 5 doesn't support overloading on const&& for member functions @@ -1957,6 +1992,7 @@ template #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED throw std::forward(e); #else + (void)e; #ifdef _MSC_VER __assume(0); #else @@ -2597,7 +2633,7 @@ struct expected_operations_base : expected_storage_base { geterr().~unexpected(); construct(std::move(rhs).get()); } else { - assign_common(rhs); + assign_common(std::move(rhs)); } } @@ -2960,7 +2996,7 @@ struct default_constructor_tag { }; // expected_default_ctor_base will ensure that expected has a deleted default -// constructor if T is not default constructible. +// consturctor if T is not default constructible. // This specialization is for when T is default constructible template , return map_error_impl(std::move(*this), std::forward(f)); } #endif +#endif +#if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \ + !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55) + template + TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) & { + return map_error_impl(*this, std::forward(f)); + } + template + TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) && { + return map_error_impl(std::move(*this), std::forward(f)); + } + template + constexpr auto transform_error(F &&f) const & { + return map_error_impl(*this, std::forward(f)); + } + template + constexpr auto transform_error(F &&f) const && { + return map_error_impl(std::move(*this), std::forward(f)); + } +#else + template + TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval(), + std::declval())) + transform_error(F &&f) & { + return map_error_impl(*this, std::forward(f)); + } + template + TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval(), + std::declval())) + transform_error(F &&f) && { + return map_error_impl(std::move(*this), std::forward(f)); + } + template + constexpr decltype(map_error_impl(std::declval(), + std::declval())) + transform_error(F &&f) const & { + return map_error_impl(*this, std::forward(f)); + } + +#ifndef TL_EXPECTED_NO_CONSTRR + template + constexpr decltype(map_error_impl(std::declval(), + std::declval())) + transform_error(F &&f) const && { + return map_error_impl(std::move(*this), std::forward(f)); + } +#endif #endif template expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) & { @@ -3697,27 +3780,37 @@ class expected : private detail::expected_move_assign_base, } } - constexpr const T *operator->() const { return valptr(); } - TL_EXPECTED_11_CONSTEXPR T *operator->() { return valptr(); } + constexpr const T *operator->() const { + TL_ASSERT(has_value()); + return valptr(); + } + TL_EXPECTED_11_CONSTEXPR T *operator->() { + TL_ASSERT(has_value()); + return valptr(); + } template ::value> * = nullptr> constexpr const U &operator*() const & { + TL_ASSERT(has_value()); return val(); } template ::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &operator*() & { + TL_ASSERT(has_value()); return val(); } template ::value> * = nullptr> constexpr const U &&operator*() const && { + TL_ASSERT(has_value()); return std::move(val()); } template ::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &&operator*() && { + TL_ASSERT(has_value()); return std::move(val()); } @@ -3753,10 +3846,22 @@ class expected : private detail::expected_move_assign_base, return std::move(val()); } - constexpr const E &error() const & { return err().value(); } - TL_EXPECTED_11_CONSTEXPR E &error() & { return err().value(); } - constexpr const E &&error() const && { return std::move(err().value()); } - TL_EXPECTED_11_CONSTEXPR E &&error() && { return std::move(err().value()); } + constexpr const E &error() const & { + TL_ASSERT(!has_value()); + return err().value(); + } + TL_EXPECTED_11_CONSTEXPR E &error() & { + TL_ASSERT(!has_value()); + return err().value(); + } + constexpr const E &&error() const && { + TL_ASSERT(!has_value()); + return std::move(err().value()); + } + TL_EXPECTED_11_CONSTEXPR E &&error() && { + TL_ASSERT(!has_value()); + return std::move(err().value()); + } template constexpr T value_or(U &&v) const & { @@ -6609,6 +6714,7 @@ struct url_search_params { * @see https://url.spec.whatwg.org/#dom-urlsearchparams-has */ inline bool has(std::string_view key) noexcept; + inline bool has(std::string_view key, std::string_view value) noexcept; /** * @see https://url.spec.whatwg.org/#dom-urlsearchparams-set @@ -6733,6 +6839,15 @@ inline bool url_search_params::has(const std::string_view key) noexcept { return entry != params.end(); } +inline bool url_search_params::has(std::string_view key, + std::string_view value) noexcept { + auto entry = + std::find_if(params.begin(), params.end(), [&key, &value](auto ¶m) { + return param.first == key && param.second == value; + }); + return entry != params.end(); +} + inline std::string url_search_params::to_string() { auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE; std::string out{}; @@ -6807,14 +6922,14 @@ inline void url_search_params::sort() { #ifndef ADA_ADA_VERSION_H #define ADA_ADA_VERSION_H -#define ADA_VERSION "2.6.0" +#define ADA_VERSION "2.6.3" namespace ada { enum { ADA_VERSION_MAJOR = 2, ADA_VERSION_MINOR = 6, - ADA_VERSION_REVISION = 0, + ADA_VERSION_REVISION = 3, }; } // namespace ada diff --git a/deps/ada/ada_c.h b/deps/ada/ada_c.h index 6e22584f612a75..170686b56320f1 100644 --- a/deps/ada/ada_c.h +++ b/deps/ada/ada_c.h @@ -51,6 +51,7 @@ bool ada_can_parse_with_base(const char* input, size_t input_length, void ada_free(ada_url result); void ada_free_owned_string(ada_owned_string owned); +ada_url ada_copy(ada_url input); bool ada_is_valid(ada_url result); @@ -67,6 +68,7 @@ ada_string ada_get_hostname(ada_url result); ada_string ada_get_pathname(ada_url result); ada_string ada_get_search(ada_url result); ada_string ada_get_protocol(ada_url result); +uint8_t ada_get_url_host_type(ada_url result); // url_aggregator setters // if ada_is_valid(result)) is false, the setters have no effect diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 007a27709d829b..3c06b16d64228e 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory. This a list of all the dependencies: * [acorn 8.10.0][] -* [ada 2.6.0][] +* [ada 2.6.3][] * [base64 0.5.0][] * [brotli 1.0.9][] * [c-ares 1.19.0][] @@ -150,7 +150,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is an abstract syntax tree walker for the ESTree format. -### ada 2.6.0 +### ada 2.6.3 The [ada](https://github.com/ada-url/ada) dependency is a fast and spec-compliant URL parser written in C++. @@ -319,7 +319,7 @@ it comes from the Chromium team's zlib fork which incorporated performance improvements not currently available in standard zlib. [acorn 8.10.0]: #acorn-8100 -[ada 2.6.0]: #ada-260 +[ada 2.6.3]: #ada-263 [base64 0.5.0]: #base64-050 [brotli 1.0.9]: #brotli-109 [c-ares 1.19.0]: #c-ares-1190 From ecf3829ac462c0edc8d72d48c15109044072d8e6 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 3 Sep 2023 00:23:02 +0000 Subject: [PATCH 2/5] deps: update ada to 2.6.5 --- deps/ada/ada.cpp | 107 ++++++++++++------ deps/ada/ada.h | 26 +++-- deps/ada/ada_c.h | 7 +- .../maintaining/maintaining-dependencies.md | 6 +- 4 files changed, 94 insertions(+), 52 deletions(-) diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp index 35f83eae9af00f..ad7a1a74cb4db0 100644 --- a/deps/ada/ada.cpp +++ b/deps/ada/ada.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */ +/* auto-generated on 2023-08-30 11:44:21 -0400. Do not edit! */ /* begin file src/ada.cpp */ #include "ada.h" /* begin file src/checkers.cpp */ @@ -116,10 +116,11 @@ ada_really_inline constexpr bool verify_dns_length( ADA_PUSH_DISABLE_ALL_WARNINGS /* begin file src/ada_idna.cpp */ -/* auto-generated on 2023-05-07 19:12:14 -0400. Do not edit! */ +/* auto-generated on 2023-08-29 15:28:19 -0400. Do not edit! */ /* begin file src/idna.cpp */ /* begin file src/unicode_transcoding.cpp */ +#include #include #include @@ -226,38 +227,22 @@ size_t utf8_length_from_utf32(const char32_t* buf, size_t len) { // We are not BOM aware. const uint32_t* p = reinterpret_cast(buf); size_t counter{0}; - for (size_t i = 0; i < len; i++) { - /** ASCII **/ - if (p[i] <= 0x7F) { - counter++; - } - /** two-byte **/ - else if (p[i] <= 0x7FF) { - counter += 2; - } - /** three-byte **/ - else if (p[i] <= 0xFFFF) { - counter += 3; - } - /** four-bytes **/ - else { - counter += 4; - } + for (size_t i = 0; i != len; ++i) { + ++counter; // ASCII + counter += static_cast(p[i] > 0x7F); // two-byte + counter += static_cast(p[i] > 0x7FF); // three-byte + counter += static_cast(p[i] > 0xFFFF); // four-bytes } return counter; } size_t utf32_length_from_utf8(const char* buf, size_t len) { const int8_t* p = reinterpret_cast(buf); - size_t counter{0}; - for (size_t i = 0; i < len; i++) { + return std::count_if(p, std::next(p, len), [](int8_t c) { // -65 is 0b10111111, anything larger in two-complement's // should start a new code point. - if (p[i] > -65) { - counter++; - } - } - return counter; + return c > -65; + }); } size_t utf32_to_utf8(const char32_t* buf, size_t len, char* utf8_output) { @@ -9525,14 +9510,14 @@ bool constexpr begins_with(std::u32string_view view, if (view.size() < prefix.size()) { return false; } - return view.substr(0, prefix.size()) == prefix; + return std::equal(prefix.begin(), prefix.end(), view.begin()); } bool constexpr begins_with(std::string_view view, std::string_view prefix) { if (view.size() < prefix.size()) { return false; } - return view.substr(0, prefix.size()) == prefix; + return std::equal(prefix.begin(), prefix.end(), view.begin()); } bool constexpr is_ascii(std::u32string_view view) { @@ -10144,13 +10129,12 @@ ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'); } +constexpr static char hex_to_binary_table[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, + 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15}; unsigned constexpr convert_hex_to_binary(const char c) noexcept { - // this code can be optimized. - if (c <= '9') { - return c - '0'; - } - char del = c >= 'a' ? 'a' : 'A'; - return 10 + (c - del); + return hex_to_binary_table[c - '0']; } std::string percent_decode(const std::string_view input, size_t first_percent) { @@ -10159,8 +10143,9 @@ std::string percent_decode(const std::string_view input, size_t first_percent) { if (first_percent == std::string_view::npos) { return std::string(input); } - std::string dest(input.substr(0, first_percent)); + std::string dest; dest.reserve(input.length()); + dest.append(input.substr(0, first_percent)); const char* pointer = input.data() + first_percent; const char* end = input.data() + input.size(); // Optimization opportunity: if the following code gets @@ -10197,9 +10182,10 @@ std::string percent_encode(const std::string_view input, return std::string(input); } - std::string result(input.substr(0, std::distance(input.begin(), pointer))); + std::string result; result.reserve(input.length()); // in the worst case, percent encoding might // produce 3 characters. + result.append(input.substr(0, std::distance(input.begin(), pointer))); for (; pointer != input.end(); pointer++) { if (character_sets::bit_at(character_set, *pointer)) { @@ -15015,7 +15001,7 @@ ada_string ada_get_protocol(ada_url result) noexcept { return ada_string_create(out.data(), out.length()); } -uint8_t ada_get_url_host_type(ada_url result) noexcept { +uint8_t ada_get_host_type(ada_url result) noexcept { ada::result& r = get_instance(result); if (!r) { return 0; @@ -15092,6 +15078,13 @@ bool ada_set_pathname(ada_url result, const char* input, return r->set_pathname(std::string_view(input, length)); } +/** + * Update the search/query of the URL. + * + * If a URL has `?` as the search value, passing empty string to this function + * does not remove the attribute. If you need to remove it, please use + * `ada_clear_search` method. + */ void ada_set_search(ada_url result, const char* input, size_t length) noexcept { ada::result& r = get_instance(result); if (r) { @@ -15099,6 +15092,13 @@ void ada_set_search(ada_url result, const char* input, size_t length) noexcept { } } +/** + * Update the hash/fragment of the URL. + * + * If a URL has `#` as the hash value, passing empty string to this function + * does not remove the attribute. If you need to remove it, please use + * `ada_clear_hash` method. + */ void ada_set_hash(ada_url result, const char* input, size_t length) noexcept { ada::result& r = get_instance(result); if (r) { @@ -15106,6 +15106,39 @@ void ada_set_hash(ada_url result, const char* input, size_t length) noexcept { } } +void ada_clear_port(ada_url result) noexcept { + ada::result& r = get_instance(result); + if (r) { + r->clear_port(); + } +} + +/** + * Removes the hash of the URL. + * + * Despite `ada_set_hash` method, this function allows the complete + * removal of the hash attribute, even if it has a value of `#`. + */ +void ada_clear_hash(ada_url result) noexcept { + ada::result& r = get_instance(result); + if (r) { + r->clear_hash(); + } +} + +/** + * Removes the search of the URL. + * + * Despite `ada_set_search` method, this function allows the complete + * removal of the search attribute, even if it has a value of `?`. + */ +void ada_clear_search(ada_url result) noexcept { + ada::result& r = get_instance(result); + if (r) { + r->clear_search(); + } +} + bool ada_has_credentials(ada_url result) noexcept { ada::result& r = get_instance(result); if (!r) { diff --git a/deps/ada/ada.h b/deps/ada/ada.h index caceff37d56121..eeae41e24f8d27 100644 --- a/deps/ada/ada.h +++ b/deps/ada/ada.h @@ -1,4 +1,4 @@ -/* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */ +/* auto-generated on 2023-08-30 11:44:21 -0400. Do not edit! */ /* begin file include/ada.h */ /** * @file ada.h @@ -8,7 +8,7 @@ #define ADA_H /* begin file include/ada/ada_idna.h */ -/* auto-generated on 2023-05-07 19:12:14 -0400. Do not edit! */ +/* auto-generated on 2023-08-29 15:28:19 -0400. Do not edit! */ /* begin file include/idna.h */ #ifndef ADA_IDNA_H #define ADA_IDNA_H @@ -4584,9 +4584,10 @@ ada_really_inline constexpr bool is_single_dot_path_segment( ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept; /** - * @details Convert hex to binary. + * @details Convert hex to binary. Caller is responsible to ensure that + * the parameter is an hexadecimal digit (0-9, A-F, a-f). */ -unsigned constexpr convert_hex_to_binary(char c) noexcept; +ada_really_inline unsigned constexpr convert_hex_to_binary(char c) noexcept; /** * first_percent should be = input.find('%') @@ -4840,6 +4841,10 @@ struct url_aggregator : url_base { /** @return true if the URL has a search component */ [[nodiscard]] inline bool has_search() const noexcept override; + inline void clear_port(); + inline void clear_hash(); + inline void clear_search() override; + private: friend ada::url_aggregator ada::parser::parse_url( std::string_view, const ada::url_aggregator *); @@ -4914,12 +4919,9 @@ struct url_aggregator : url_base { inline void update_base_port(uint32_t input); inline void append_base_pathname(const std::string_view input); inline uint32_t retrieve_base_port() const; - inline void clear_port(); inline void clear_hostname(); - inline void clear_hash(); - inline void clear_pathname() override; - inline void clear_search() override; inline void clear_password(); + inline void clear_pathname() override; inline bool has_dash_dot() const noexcept; void delete_dash_dot(); inline void consume_prepared_path(std::string_view input); @@ -6448,7 +6450,9 @@ inline void url_aggregator::clear_hostname() { " with " + components.to_string() + "\n" + to_diagram()); #endif ADA_ASSERT_TRUE(has_authority()); - ADA_ASSERT_TRUE(has_empty_hostname()); + ADA_ASSERT_EQUAL(has_empty_hostname(), true, + "hostname should have been cleared on buffer=" + buffer + + " with " + components.to_string() + "\n" + to_diagram()); ADA_ASSERT_TRUE(validate()); } @@ -6922,14 +6926,14 @@ inline void url_search_params::sort() { #ifndef ADA_ADA_VERSION_H #define ADA_ADA_VERSION_H -#define ADA_VERSION "2.6.3" +#define ADA_VERSION "2.6.5" namespace ada { enum { ADA_VERSION_MAJOR = 2, ADA_VERSION_MINOR = 6, - ADA_VERSION_REVISION = 3, + ADA_VERSION_REVISION = 5, }; } // namespace ada diff --git a/deps/ada/ada_c.h b/deps/ada/ada_c.h index 170686b56320f1..0d01e57c48d72d 100644 --- a/deps/ada/ada_c.h +++ b/deps/ada/ada_c.h @@ -68,7 +68,7 @@ ada_string ada_get_hostname(ada_url result); ada_string ada_get_pathname(ada_url result); ada_string ada_get_search(ada_url result); ada_string ada_get_protocol(ada_url result); -uint8_t ada_get_url_host_type(ada_url result); +uint8_t ada_get_host_type(ada_url result); // url_aggregator setters // if ada_is_valid(result)) is false, the setters have no effect @@ -84,6 +84,11 @@ bool ada_set_pathname(ada_url result, const char* input, size_t length); void ada_set_search(ada_url result, const char* input, size_t length); void ada_set_hash(ada_url result, const char* input, size_t length); +// url_aggregator clear methods +void ada_clear_port(ada_url result); +void ada_clear_hash(ada_url result); +void ada_clear_search(ada_url result); + // url_aggregator functions // if ada_is_valid(result) is false, functions below will return false bool ada_has_credentials(ada_url result); diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 3c06b16d64228e..5c485a8090b4f9 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory. This a list of all the dependencies: * [acorn 8.10.0][] -* [ada 2.6.3][] +* [ada 2.6.5][] * [base64 0.5.0][] * [brotli 1.0.9][] * [c-ares 1.19.0][] @@ -150,7 +150,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is an abstract syntax tree walker for the ESTree format. -### ada 2.6.3 +### ada 2.6.5 The [ada](https://github.com/ada-url/ada) dependency is a fast and spec-compliant URL parser written in C++. @@ -319,7 +319,7 @@ it comes from the Chromium team's zlib fork which incorporated performance improvements not currently available in standard zlib. [acorn 8.10.0]: #acorn-8100 -[ada 2.6.3]: #ada-263 +[ada 2.6.5]: #ada-265 [base64 0.5.0]: #base64-050 [brotli 1.0.9]: #brotli-109 [c-ares 1.19.0]: #c-ares-1190 From c97a99203a04c800207fe98205f8bbde6f9d2c30 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 10 Sep 2023 00:23:06 +0000 Subject: [PATCH 3/5] deps: update ada to 2.6.7 --- deps/ada/ada.cpp | 10 +++++++++- deps/ada/ada.h | 6 +++--- deps/ada/ada_c.h | 1 + .../maintaining/maintaining-dependencies.md | 6 +++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp index ad7a1a74cb4db0..5eb0a3f2ad0b27 100644 --- a/deps/ada/ada.cpp +++ b/deps/ada/ada.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2023-08-30 11:44:21 -0400. Do not edit! */ +/* auto-generated on 2023-09-05 16:55:45 -0400. Do not edit! */ /* begin file src/ada.cpp */ #include "ada.h" /* begin file src/checkers.cpp */ @@ -15009,6 +15009,14 @@ uint8_t ada_get_host_type(ada_url result) noexcept { return r->host_type; } +uint8_t ada_get_scheme_type(ada_url result) noexcept { + ada::result& r = get_instance(result); + if (!r) { + return 0; + } + return r->type; +} + bool ada_set_href(ada_url result, const char* input, size_t length) noexcept { ada::result& r = get_instance(result); if (!r) { diff --git a/deps/ada/ada.h b/deps/ada/ada.h index eeae41e24f8d27..1485e37356bcd5 100644 --- a/deps/ada/ada.h +++ b/deps/ada/ada.h @@ -1,4 +1,4 @@ -/* auto-generated on 2023-08-30 11:44:21 -0400. Do not edit! */ +/* auto-generated on 2023-09-05 16:55:45 -0400. Do not edit! */ /* begin file include/ada.h */ /** * @file ada.h @@ -6926,14 +6926,14 @@ inline void url_search_params::sort() { #ifndef ADA_ADA_VERSION_H #define ADA_ADA_VERSION_H -#define ADA_VERSION "2.6.5" +#define ADA_VERSION "2.6.7" namespace ada { enum { ADA_VERSION_MAJOR = 2, ADA_VERSION_MINOR = 6, - ADA_VERSION_REVISION = 5, + ADA_VERSION_REVISION = 7, }; } // namespace ada diff --git a/deps/ada/ada_c.h b/deps/ada/ada_c.h index 0d01e57c48d72d..040915518f32a0 100644 --- a/deps/ada/ada_c.h +++ b/deps/ada/ada_c.h @@ -69,6 +69,7 @@ ada_string ada_get_pathname(ada_url result); ada_string ada_get_search(ada_url result); ada_string ada_get_protocol(ada_url result); uint8_t ada_get_host_type(ada_url result); +uint8_t ada_get_scheme_type(ada_url result); // url_aggregator setters // if ada_is_valid(result)) is false, the setters have no effect diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 5c485a8090b4f9..7fd9b3a56d97d3 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory. This a list of all the dependencies: * [acorn 8.10.0][] -* [ada 2.6.5][] +* [ada 2.6.7][] * [base64 0.5.0][] * [brotli 1.0.9][] * [c-ares 1.19.0][] @@ -150,7 +150,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is an abstract syntax tree walker for the ESTree format. -### ada 2.6.5 +### ada 2.6.7 The [ada](https://github.com/ada-url/ada) dependency is a fast and spec-compliant URL parser written in C++. @@ -319,7 +319,7 @@ it comes from the Chromium team's zlib fork which incorporated performance improvements not currently available in standard zlib. [acorn 8.10.0]: #acorn-8100 -[ada 2.6.5]: #ada-265 +[ada 2.6.7]: #ada-267 [base64 0.5.0]: #base64-050 [brotli 1.0.9]: #brotli-109 [c-ares 1.19.0]: #c-ares-1190 From f61486391bad7f9f066b4bb2b0417f5aaa42db39 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 19 Sep 2023 23:52:22 +0000 Subject: [PATCH 4/5] deps: update ada to 2.6.8 --- deps/ada/ada.cpp | 9 ++++---- deps/ada/ada.h | 21 +++++++++++-------- .../maintaining/maintaining-dependencies.md | 6 +++--- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp index 5eb0a3f2ad0b27..1a028b200bc960 100644 --- a/deps/ada/ada.cpp +++ b/deps/ada/ada.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2023-09-05 16:55:45 -0400. Do not edit! */ +/* auto-generated on 2023-09-19 16:48:25 -0400. Do not edit! */ /* begin file src/ada.cpp */ #include "ada.h" /* begin file src/checkers.cpp */ @@ -11864,7 +11864,7 @@ bool url::set_host_or_hostname(const std::string_view input) { } // Let host be the result of host parsing host_view with url is not special. - if (host_view.empty()) { + if (host_view.empty() && !is_special()) { host = ""; return true; } @@ -13625,13 +13625,12 @@ bool url_aggregator::set_host_or_hostname(const std::string_view input) { // empty string, and either url includes credentials or url's port is // non-null, return. else if (host_view.empty() && - (is_special() || has_credentials() || - components.port != url_components::omitted)) { + (is_special() || has_credentials() || has_port())) { return false; } // Let host be the result of host parsing host_view with url is not special. - if (host_view.empty()) { + if (host_view.empty() && !is_special()) { if (has_hostname()) { clear_hostname(); // easy! } else if (has_dash_dot()) { diff --git a/deps/ada/ada.h b/deps/ada/ada.h index 1485e37356bcd5..b3ae3d0aa7635b 100644 --- a/deps/ada/ada.h +++ b/deps/ada/ada.h @@ -1,4 +1,4 @@ -/* auto-generated on 2023-09-05 16:55:45 -0400. Do not edit! */ +/* auto-generated on 2023-09-19 16:48:25 -0400. Do not edit! */ /* begin file include/ada.h */ /** * @file ada.h @@ -1055,9 +1055,10 @@ inline constexpr bool is_normalized_windows_drive_letter( return input.size() >= 2 && (is_alpha(input[0]) && (input[1] == ':')); } -ada_really_inline constexpr bool begins_with(std::string_view view, - std::string_view prefix) { +ada_really_inline bool begins_with(std::string_view view, + std::string_view prefix) { // in C++20, you have view.begins_with(prefix) + // std::equal is constexpr in C++20 return view.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), view.begin()); } @@ -5020,10 +5021,10 @@ inline constexpr bool is_normalized_windows_drive_letter( std::string_view input) noexcept; /** - * @warning Will be removed when Ada supports C++20. + * @warning Will be removed when Ada requires C++20. */ -ada_really_inline constexpr bool begins_with(std::string_view view, - std::string_view prefix); +ada_really_inline bool begins_with(std::string_view view, + std::string_view prefix); /** * Returns true if an input is an ipv4 address. @@ -6557,7 +6558,9 @@ inline bool url_aggregator::has_hostname() const noexcept { inline bool url_aggregator::has_port() const noexcept { ada_log("url_aggregator::has_port"); - return components.pathname_start != components.host_end; + // A URL cannot have a username/password/port if its host is null or the empty + // string, or its scheme is "file". + return has_hostname() && components.pathname_start != components.host_end; } inline bool url_aggregator::has_dash_dot() const noexcept { @@ -6926,14 +6929,14 @@ inline void url_search_params::sort() { #ifndef ADA_ADA_VERSION_H #define ADA_ADA_VERSION_H -#define ADA_VERSION "2.6.7" +#define ADA_VERSION "2.6.8" namespace ada { enum { ADA_VERSION_MAJOR = 2, ADA_VERSION_MINOR = 6, - ADA_VERSION_REVISION = 7, + ADA_VERSION_REVISION = 8, }; } // namespace ada diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 7fd9b3a56d97d3..21e0d91883ef01 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory. This a list of all the dependencies: * [acorn 8.10.0][] -* [ada 2.6.7][] +* [ada 2.6.8][] * [base64 0.5.0][] * [brotli 1.0.9][] * [c-ares 1.19.0][] @@ -150,7 +150,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is an abstract syntax tree walker for the ESTree format. -### ada 2.6.7 +### ada 2.6.8 The [ada](https://github.com/ada-url/ada) dependency is a fast and spec-compliant URL parser written in C++. @@ -319,7 +319,7 @@ it comes from the Chromium team's zlib fork which incorporated performance improvements not currently available in standard zlib. [acorn 8.10.0]: #acorn-8100 -[ada 2.6.7]: #ada-267 +[ada 2.6.8]: #ada-268 [base64 0.5.0]: #base64-050 [brotli 1.0.9]: #brotli-109 [c-ares 1.19.0]: #c-ares-1190 From 4e9117311920d1df65fe1d2d6b4cbe5a4d628e66 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Fri, 29 Sep 2023 18:40:10 +0000 Subject: [PATCH 5/5] deps: update ada to 2.6.9 --- deps/ada/ada.cpp | 11 ++++++----- deps/ada/ada.h | 13 ++++++------- .../maintaining/maintaining-dependencies.md | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp index 1a028b200bc960..0cd21f21090bc6 100644 --- a/deps/ada/ada.cpp +++ b/deps/ada/ada.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2023-09-19 16:48:25 -0400. Do not edit! */ +/* auto-generated on 2023-09-29 13:28:16 -0400. Do not edit! */ /* begin file src/ada.cpp */ #include "ada.h" /* begin file src/checkers.cpp */ @@ -116,7 +116,7 @@ ada_really_inline constexpr bool verify_dns_length( ADA_PUSH_DISABLE_ALL_WARNINGS /* begin file src/ada_idna.cpp */ -/* auto-generated on 2023-08-29 15:28:19 -0400. Do not edit! */ +/* auto-generated on 2023-09-19 15:58:51 -0400. Do not edit! */ /* begin file src/idna.cpp */ /* begin file src/unicode_transcoding.cpp */ @@ -9505,18 +9505,19 @@ bool is_label_valid(const std::u32string_view label) { namespace ada::idna { -bool constexpr begins_with(std::u32string_view view, - std::u32string_view prefix) { +bool begins_with(std::u32string_view view, std::u32string_view prefix) { if (view.size() < prefix.size()) { return false; } + // constexpr as of C++20 return std::equal(prefix.begin(), prefix.end(), view.begin()); } -bool constexpr begins_with(std::string_view view, std::string_view prefix) { +bool begins_with(std::string_view view, std::string_view prefix) { if (view.size() < prefix.size()) { return false; } + // constexpr as of C++20 return std::equal(prefix.begin(), prefix.end(), view.begin()); } diff --git a/deps/ada/ada.h b/deps/ada/ada.h index b3ae3d0aa7635b..da75a5d985b6cd 100644 --- a/deps/ada/ada.h +++ b/deps/ada/ada.h @@ -1,4 +1,4 @@ -/* auto-generated on 2023-09-19 16:48:25 -0400. Do not edit! */ +/* auto-generated on 2023-09-29 13:28:16 -0400. Do not edit! */ /* begin file include/ada.h */ /** * @file ada.h @@ -8,7 +8,7 @@ #define ADA_H /* begin file include/ada/ada_idna.h */ -/* auto-generated on 2023-08-29 15:28:19 -0400. Do not edit! */ +/* auto-generated on 2023-09-19 15:58:51 -0400. Do not edit! */ /* begin file include/idna.h */ #ifndef ADA_IDNA_H #define ADA_IDNA_H @@ -129,9 +129,8 @@ std::string to_ascii(std::string_view ut8_string); // https://url.spec.whatwg.org/#forbidden-domain-code-point bool contains_forbidden_domain_code_point(std::string_view ascii_string); -bool constexpr begins_with(std::u32string_view view, - std::u32string_view prefix); -bool constexpr begins_with(std::string_view view, std::string_view prefix); +bool begins_with(std::u32string_view view, std::u32string_view prefix); +bool begins_with(std::string_view view, std::string_view prefix); bool constexpr is_ascii(std::u32string_view view); bool constexpr is_ascii(std::string_view view); @@ -6929,14 +6928,14 @@ inline void url_search_params::sort() { #ifndef ADA_ADA_VERSION_H #define ADA_ADA_VERSION_H -#define ADA_VERSION "2.6.8" +#define ADA_VERSION "2.6.9" namespace ada { enum { ADA_VERSION_MAJOR = 2, ADA_VERSION_MINOR = 6, - ADA_VERSION_REVISION = 8, + ADA_VERSION_REVISION = 9, }; } // namespace ada diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 21e0d91883ef01..b9eb652aaa47c7 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory. This a list of all the dependencies: * [acorn 8.10.0][] -* [ada 2.6.8][] +* [ada 2.6.9][] * [base64 0.5.0][] * [brotli 1.0.9][] * [c-ares 1.19.0][] @@ -150,7 +150,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser. [acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is an abstract syntax tree walker for the ESTree format. -### ada 2.6.8 +### ada 2.6.9 The [ada](https://github.com/ada-url/ada) dependency is a fast and spec-compliant URL parser written in C++. @@ -319,7 +319,7 @@ it comes from the Chromium team's zlib fork which incorporated performance improvements not currently available in standard zlib. [acorn 8.10.0]: #acorn-8100 -[ada 2.6.8]: #ada-268 +[ada 2.6.9]: #ada-269 [base64 0.5.0]: #base64-050 [brotli 1.0.9]: #brotli-109 [c-ares 1.19.0]: #c-ares-1190