Skip to content

Commit 2ca867f

Browse files
nodejs-github-bottargos
authored andcommitted
deps: update ada to 2.6.3
PR-URL: #49340 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 2ff4e71 commit 2ca867f

File tree

4 files changed

+152
-19
lines changed

4 files changed

+152
-19
lines changed

deps/ada/ada.cpp

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */
1+
/* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */
22
/* begin file src/ada.cpp */
33
#include "ada.h"
44
/* begin file src/checkers.cpp */
@@ -11231,6 +11231,7 @@ bool url::parse_ipv4(std::string_view input) {
1123111231
} else {
1123211232
host = ada::serializers::ipv4(ipv4); // We have to reserialize the address.
1123311233
}
11234+
host_type = IPV4;
1123411235
return true;
1123511236
}
1123611237

@@ -11460,6 +11461,7 @@ bool url::parse_ipv6(std::string_view input) {
1146011461
}
1146111462
host = ada::serializers::ipv6(address);
1146211463
ada_log("parse_ipv6 ", *host);
11464+
host_type = IPV6;
1146311465
return true;
1146411466
}
1146511467

@@ -12569,7 +12571,6 @@ result_type parse_url(std::string_view user_input,
1256912571
// If c is U+002F (/) and remaining starts with U+002F (/),
1257012572
// then set state to special authority ignore slashes state and increase
1257112573
// pointer by 1.
12572-
state = ada::state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
1257312574
std::string_view view = helpers::substring(url_data, input_position);
1257412575
if (ada::checkers::begins_with(view, "//")) {
1257512576
input_position += 2;
@@ -14021,6 +14022,7 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
1402114022
update_base_hostname(
1402214023
ada::serializers::ipv4(ipv4)); // We have to reserialize the address.
1402314024
}
14025+
host_type = IPV4;
1402414026
ADA_ASSERT_TRUE(validate());
1402514027
return true;
1402614028
}
@@ -14256,6 +14258,7 @@ bool url_aggregator::parse_ipv6(std::string_view input) {
1425614258
update_base_hostname(ada::serializers::ipv6(address));
1425714259
ada_log("parse_ipv6 ", get_hostname());
1425814260
ADA_ASSERT_TRUE(validate());
14261+
host_type = IPV6;
1425914262
return true;
1426014263
}
1426114264

@@ -14890,6 +14893,11 @@ void ada_free(ada_url result) noexcept {
1489014893
delete r;
1489114894
}
1489214895

14896+
ada_url ada_copy(ada_url input) noexcept {
14897+
ada::result<ada::url_aggregator>& r = get_instance(input);
14898+
return new ada::result<ada::url_aggregator>(r);
14899+
}
14900+
1489314901
bool ada_is_valid(ada_url result) noexcept {
1489414902
ada::result<ada::url_aggregator>& r = get_instance(result);
1489514903
return r.has_value();
@@ -15007,6 +15015,14 @@ ada_string ada_get_protocol(ada_url result) noexcept {
1500715015
return ada_string_create(out.data(), out.length());
1500815016
}
1500915017

15018+
uint8_t ada_get_url_host_type(ada_url result) noexcept {
15019+
ada::result<ada::url_aggregator>& r = get_instance(result);
15020+
if (!r) {
15021+
return 0;
15022+
}
15023+
return r->host_type;
15024+
}
15025+
1501015026
bool ada_set_href(ada_url result, const char* input, size_t length) noexcept {
1501115027
ada::result<ada::url_aggregator>& r = get_instance(result);
1501215028
if (!r) {

deps/ada/ada.h

+129-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2023-07-23 15:03:22 -0400. Do not edit! */
1+
/* auto-generated on 2023-08-26 17:38:28 -0400. Do not edit! */
22
/* begin file include/ada.h */
33
/**
44
* @file ada.h
@@ -1008,6 +1008,7 @@ ada_really_inline bool bit_at(const uint8_t a[], const uint8_t i) {
10081008
#define ADA_CHECKERS_INL_H
10091009

10101010

1011+
#include <algorithm>
10111012
#include <string_view>
10121013
#include <cstring>
10131014

@@ -1058,7 +1059,7 @@ ada_really_inline constexpr bool begins_with(std::string_view view,
10581059
std::string_view prefix) {
10591060
// in C++20, you have view.begins_with(prefix)
10601061
return view.size() >= prefix.size() &&
1061-
(view.substr(0, prefix.size()) == prefix);
1062+
std::equal(prefix.begin(), prefix.end(), view.begin());
10621063
}
10631064

10641065
} // namespace ada::checkers
@@ -1406,6 +1407,25 @@ constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept;
14061407

14071408
namespace ada {
14081409

1410+
/**
1411+
* Type of URL host as an enum.
1412+
*/
1413+
enum url_host_type : uint8_t {
1414+
/**
1415+
* Represents common URLs such as "https://www.google.com"
1416+
*/
1417+
DEFAULT = 0,
1418+
/**
1419+
* Represents ipv4 addresses such as "http://127.0.0.1"
1420+
*/
1421+
IPV4 = 1,
1422+
/**
1423+
* Represents ipv6 addresses such as
1424+
* "http://[2001:db8:3333:4444:5555:6666:7777:8888]"
1425+
*/
1426+
IPV6 = 2,
1427+
};
1428+
14091429
/**
14101430
* @brief Base class of URL implementations
14111431
*
@@ -1428,6 +1448,11 @@ struct url_base {
14281448
*/
14291449
bool has_opaque_path{false};
14301450

1451+
/**
1452+
* URL hosts type
1453+
*/
1454+
url_host_type host_type = url_host_type::DEFAULT;
1455+
14311456
/**
14321457
* @private
14331458
*/
@@ -1768,8 +1793,8 @@ inline int fast_digit_count(uint32_t x) noexcept {
17681793
#define TL_EXPECTED_HPP
17691794

17701795
#define TL_EXPECTED_VERSION_MAJOR 1
1771-
#define TL_EXPECTED_VERSION_MINOR 0
1772-
#define TL_EXPECTED_VERSION_PATCH 1
1796+
#define TL_EXPECTED_VERSION_MINOR 1
1797+
#define TL_EXPECTED_VERSION_PATCH 0
17731798

17741799
#include <exception>
17751800
#include <functional>
@@ -1802,6 +1827,16 @@ inline int fast_digit_count(uint32_t x) noexcept {
18021827
#define TL_EXPECTED_GCC55
18031828
#endif
18041829

1830+
#if !defined(TL_ASSERT)
1831+
// can't have assert in constexpr in C++11 and GCC 4.9 has a compiler bug
1832+
#if (__cplusplus > 201103L) && !defined(TL_EXPECTED_GCC49)
1833+
#include <cassert>
1834+
#define TL_ASSERT(x) assert(x)
1835+
#else
1836+
#define TL_ASSERT(x)
1837+
#endif
1838+
#endif
1839+
18051840
#if (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 9 && \
18061841
!defined(__clang__))
18071842
// GCC < 5 doesn't support overloading on const&& for member functions
@@ -1957,6 +1992,7 @@ template <typename E>
19571992
#ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
19581993
throw std::forward<E>(e);
19591994
#else
1995+
(void)e;
19601996
#ifdef _MSC_VER
19611997
__assume(0);
19621998
#else
@@ -2597,7 +2633,7 @@ struct expected_operations_base : expected_storage_base<T, E> {
25972633
geterr().~unexpected<E>();
25982634
construct(std::move(rhs).get());
25992635
} else {
2600-
assign_common(rhs);
2636+
assign_common(std::move(rhs));
26012637
}
26022638
}
26032639

@@ -2960,7 +2996,7 @@ struct default_constructor_tag {
29602996
};
29612997

29622998
// expected_default_ctor_base will ensure that expected has a deleted default
2963-
// constructor if T is not default constructible.
2999+
// consturctor if T is not default constructible.
29643000
// This specialization is for when T is default constructible
29653001
template <class T, class E,
29663002
bool Enable =
@@ -3255,6 +3291,53 @@ class expected : private detail::expected_move_assign_base<T, E>,
32553291
return map_error_impl(std::move(*this), std::forward<F>(f));
32563292
}
32573293
#endif
3294+
#endif
3295+
#if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && \
3296+
!defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
3297+
template <class F>
3298+
TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) & {
3299+
return map_error_impl(*this, std::forward<F>(f));
3300+
}
3301+
template <class F>
3302+
TL_EXPECTED_11_CONSTEXPR auto transform_error(F &&f) && {
3303+
return map_error_impl(std::move(*this), std::forward<F>(f));
3304+
}
3305+
template <class F>
3306+
constexpr auto transform_error(F &&f) const & {
3307+
return map_error_impl(*this, std::forward<F>(f));
3308+
}
3309+
template <class F>
3310+
constexpr auto transform_error(F &&f) const && {
3311+
return map_error_impl(std::move(*this), std::forward<F>(f));
3312+
}
3313+
#else
3314+
template <class F>
3315+
TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &>(),
3316+
std::declval<F &&>()))
3317+
transform_error(F &&f) & {
3318+
return map_error_impl(*this, std::forward<F>(f));
3319+
}
3320+
template <class F>
3321+
TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected &&>(),
3322+
std::declval<F &&>()))
3323+
transform_error(F &&f) && {
3324+
return map_error_impl(std::move(*this), std::forward<F>(f));
3325+
}
3326+
template <class F>
3327+
constexpr decltype(map_error_impl(std::declval<const expected &>(),
3328+
std::declval<F &&>()))
3329+
transform_error(F &&f) const & {
3330+
return map_error_impl(*this, std::forward<F>(f));
3331+
}
3332+
3333+
#ifndef TL_EXPECTED_NO_CONSTRR
3334+
template <class F>
3335+
constexpr decltype(map_error_impl(std::declval<const expected &&>(),
3336+
std::declval<F &&>()))
3337+
transform_error(F &&f) const && {
3338+
return map_error_impl(std::move(*this), std::forward<F>(f));
3339+
}
3340+
#endif
32583341
#endif
32593342
template <class F>
32603343
expected TL_EXPECTED_11_CONSTEXPR or_else(F &&f) & {
@@ -3697,27 +3780,37 @@ class expected : private detail::expected_move_assign_base<T, E>,
36973780
}
36983781
}
36993782

3700-
constexpr const T *operator->() const { return valptr(); }
3701-
TL_EXPECTED_11_CONSTEXPR T *operator->() { return valptr(); }
3783+
constexpr const T *operator->() const {
3784+
TL_ASSERT(has_value());
3785+
return valptr();
3786+
}
3787+
TL_EXPECTED_11_CONSTEXPR T *operator->() {
3788+
TL_ASSERT(has_value());
3789+
return valptr();
3790+
}
37023791

37033792
template <class U = T,
37043793
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
37053794
constexpr const U &operator*() const & {
3795+
TL_ASSERT(has_value());
37063796
return val();
37073797
}
37083798
template <class U = T,
37093799
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
37103800
TL_EXPECTED_11_CONSTEXPR U &operator*() & {
3801+
TL_ASSERT(has_value());
37113802
return val();
37123803
}
37133804
template <class U = T,
37143805
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
37153806
constexpr const U &&operator*() const && {
3807+
TL_ASSERT(has_value());
37163808
return std::move(val());
37173809
}
37183810
template <class U = T,
37193811
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
37203812
TL_EXPECTED_11_CONSTEXPR U &&operator*() && {
3813+
TL_ASSERT(has_value());
37213814
return std::move(val());
37223815
}
37233816

@@ -3753,10 +3846,22 @@ class expected : private detail::expected_move_assign_base<T, E>,
37533846
return std::move(val());
37543847
}
37553848

3756-
constexpr const E &error() const & { return err().value(); }
3757-
TL_EXPECTED_11_CONSTEXPR E &error() & { return err().value(); }
3758-
constexpr const E &&error() const && { return std::move(err().value()); }
3759-
TL_EXPECTED_11_CONSTEXPR E &&error() && { return std::move(err().value()); }
3849+
constexpr const E &error() const & {
3850+
TL_ASSERT(!has_value());
3851+
return err().value();
3852+
}
3853+
TL_EXPECTED_11_CONSTEXPR E &error() & {
3854+
TL_ASSERT(!has_value());
3855+
return err().value();
3856+
}
3857+
constexpr const E &&error() const && {
3858+
TL_ASSERT(!has_value());
3859+
return std::move(err().value());
3860+
}
3861+
TL_EXPECTED_11_CONSTEXPR E &&error() && {
3862+
TL_ASSERT(!has_value());
3863+
return std::move(err().value());
3864+
}
37603865

37613866
template <class U>
37623867
constexpr T value_or(U &&v) const & {
@@ -6609,6 +6714,7 @@ struct url_search_params {
66096714
* @see https://url.spec.whatwg.org/#dom-urlsearchparams-has
66106715
*/
66116716
inline bool has(std::string_view key) noexcept;
6717+
inline bool has(std::string_view key, std::string_view value) noexcept;
66126718

66136719
/**
66146720
* @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 {
67336839
return entry != params.end();
67346840
}
67356841

6842+
inline bool url_search_params::has(std::string_view key,
6843+
std::string_view value) noexcept {
6844+
auto entry =
6845+
std::find_if(params.begin(), params.end(), [&key, &value](auto &param) {
6846+
return param.first == key && param.second == value;
6847+
});
6848+
return entry != params.end();
6849+
}
6850+
67366851
inline std::string url_search_params::to_string() {
67376852
auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE;
67386853
std::string out{};
@@ -6807,14 +6922,14 @@ inline void url_search_params::sort() {
68076922
#ifndef ADA_ADA_VERSION_H
68086923
#define ADA_ADA_VERSION_H
68096924

6810-
#define ADA_VERSION "2.6.0"
6925+
#define ADA_VERSION "2.6.3"
68116926

68126927
namespace ada {
68136928

68146929
enum {
68156930
ADA_VERSION_MAJOR = 2,
68166931
ADA_VERSION_MINOR = 6,
6817-
ADA_VERSION_REVISION = 0,
6932+
ADA_VERSION_REVISION = 3,
68186933
};
68196934

68206935
} // namespace ada

deps/ada/ada_c.h

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ bool ada_can_parse_with_base(const char* input, size_t input_length,
5151

5252
void ada_free(ada_url result);
5353
void ada_free_owned_string(ada_owned_string owned);
54+
ada_url ada_copy(ada_url input);
5455

5556
bool ada_is_valid(ada_url result);
5657

@@ -67,6 +68,7 @@ ada_string ada_get_hostname(ada_url result);
6768
ada_string ada_get_pathname(ada_url result);
6869
ada_string ada_get_search(ada_url result);
6970
ada_string ada_get_protocol(ada_url result);
71+
uint8_t ada_get_url_host_type(ada_url result);
7072

7173
// url_aggregator setters
7274
// if ada_is_valid(result)) is false, the setters have no effect

doc/contributing/maintaining/maintaining-dependencies.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ All dependencies are located within the `deps` directory.
99
This a list of all the dependencies:
1010

1111
* [acorn 8.10.0][]
12-
* [ada 2.6.0][]
12+
* [ada 2.6.3][]
1313
* [base64 0.5.0][]
1414
* [brotli 1.0.9][]
1515
* [c-ares 1.19.0][]
@@ -150,7 +150,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser.
150150
[acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is
151151
an abstract syntax tree walker for the ESTree format.
152152

153-
### ada 2.6.0
153+
### ada 2.6.3
154154

155155
The [ada](https://github.com/ada-url/ada) dependency is a
156156
fast and spec-compliant URL parser written in C++.
@@ -319,7 +319,7 @@ it comes from the Chromium team's zlib fork which incorporated
319319
performance improvements not currently available in standard zlib.
320320

321321
[acorn 8.10.0]: #acorn-8100
322-
[ada 2.6.0]: #ada-260
322+
[ada 2.6.3]: #ada-263
323323
[base64 0.5.0]: #base64-050
324324
[brotli 1.0.9]: #brotli-109
325325
[c-ares 1.19.0]: #c-ares-1190

0 commit comments

Comments
 (0)