deps: update ada to 2.6.3

PR-URL: https://github.com/nodejs/node/pull/49340
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Node.js GitHub Bot 2023-08-27 00:22:38 +00:00
parent 51f4ff2450
commit a20a328a9b
4 changed files with 152 additions and 19 deletions

20
deps/ada/ada.cpp vendored
View File

@ -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 @@ final:
} 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 @@ final:
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<ada::url_aggregator>& r = get_instance(input);
return new ada::result<ada::url_aggregator>(r);
}
bool ada_is_valid(ada_url result) noexcept {
ada::result<ada::url_aggregator>& 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<ada::url_aggregator>& 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<ada::url_aggregator>& r = get_instance(result);
if (!r) {

143
deps/ada/ada.h vendored
View File

@ -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 <algorithm>
#include <string_view>
#include <cstring>
@ -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 <exception>
#include <functional>
@ -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 <cassert>
#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 <typename E>
#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
throw std::forward<E>(e);
#else
(void)e;
#ifdef _MSC_VER
__assume(0);
#else
@ -2597,7 +2633,7 @@ struct expected_operations_base : expected_storage_base<T, E> {
geterr().~unexpected<E>();
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 <class T, class E,
bool Enable =
@ -3255,6 +3291,53 @@ class expected : private detail::expected_move_assign_base<T, E>,
return map_error_impl(std::move(*this), std::forward<F>(f));
}
#endif
#endif
#if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \
!defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
template <class F>
TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) & {
return map_error_impl(*this, std::forward<F>(f));
}
template <class F>
TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) && {
return map_error_impl(std::move(*this), std::forward<F>(f));
}
template <class F>
constexpr auto transform_error(F &&f) const & {
return map_error_impl(*this, std::forward<F>(f));
}
template <class F>
constexpr auto transform_error(F &&f) const && {
return map_error_impl(std::move(*this), std::forward<F>(f));
}
#else
template <class F>
TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &>(),
std::declval<F &&>()))
transform_error(F &&f) & {
return map_error_impl(*this, std::forward<F>(f));
}
template <class F>
TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &&>(),
std::declval<F &&>()))
transform_error(F &&f) && {
return map_error_impl(std::move(*this), std::forward<F>(f));
}
template <class F>
constexpr decltype(map_error_impl(std::declval<const expected &>(),
std::declval<F &&>()))
transform_error(F &&f) const & {
return map_error_impl(*this, std::forward<F>(f));
}
#ifndef TL_EXPECTED_NO_CONSTRR
template <class F>
constexpr decltype(map_error_impl(std::declval<const expected &&>(),
std::declval<F &&>()))
transform_error(F &&f) const && {
return map_error_impl(std::move(*this), std::forward<F>(f));
}
#endif
#endif
template <class F>
expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) & {
@ -3697,27 +3780,37 @@ class expected : private detail::expected_move_assign_base<T, E>,
}
}
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 <class U = T,
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
constexpr const U &operator*() const & {
TL_ASSERT(has_value());
return val();
}
template <class U = T,
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
TL_EXPECTED_11_CONSTEXPR U &operator*() & {
TL_ASSERT(has_value());
return val();
}
template <class U = T,
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
constexpr const U &&operator*() const && {
TL_ASSERT(has_value());
return std::move(val());
}
template <class U = T,
detail::enable_if_t<!std::is_void<U>::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<T, E>,
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 <class U>
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 &param) {
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

2
deps/ada/ada_c.h vendored
View File

@ -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

View File

@ -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