Skip to content

Commit 71f9164

Browse files
committed
deps: update ada to 2.6.3
PR-URL: nodejs/node#49340 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 8fe3907 commit 71f9164

File tree

4 files changed

+152
-19
lines changed

4 files changed

+152
-19
lines changed

graal-nodejs/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 */
@@ -11235,6 +11235,7 @@ bool url::parse_ipv4(std::string_view input) {
1123511235
} else {
1123611236
host = ada::serializers::ipv4(ipv4); // We have to reserialize the address.
1123711237
}
11238+
host_type = IPV4;
1123811239
return true;
1123911240
}
1124011241

@@ -11464,6 +11465,7 @@ bool url::parse_ipv6(std::string_view input) {
1146411465
}
1146511466
host = ada::serializers::ipv6(address);
1146611467
ada_log("parse_ipv6 ", *host);
11468+
host_type = IPV6;
1146711469
return true;
1146811470
}
1146911471

@@ -12573,7 +12575,6 @@ result_type parse_url(std::string_view user_input,
1257312575
// If c is U+002F (/) and remaining starts with U+002F (/),
1257412576
// then set state to special authority ignore slashes state and increase
1257512577
// pointer by 1.
12576-
state = ada::state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
1257712578
std::string_view view = helpers::substring(url_data, input_position);
1257812579
if (ada::checkers::begins_with(view, "//")) {
1257912580
input_position += 2;
@@ -14025,6 +14026,7 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
1402514026
update_base_hostname(
1402614027
ada::serializers::ipv4(ipv4)); // We have to reserialize the address.
1402714028
}
14029+
host_type = IPV4;
1402814030
ADA_ASSERT_TRUE(validate());
1402914031
return true;
1403014032
}
@@ -14260,6 +14262,7 @@ bool url_aggregator::parse_ipv6(std::string_view input) {
1426014262
update_base_hostname(ada::serializers::ipv6(address));
1426114263
ada_log("parse_ipv6 ", get_hostname());
1426214264
ADA_ASSERT_TRUE(validate());
14265+
host_type = IPV6;
1426314266
return true;
1426414267
}
1426514268

@@ -14894,6 +14897,11 @@ void ada_free(ada_url result) noexcept {
1489414897
delete r;
1489514898
}
1489614899

14900+
ada_url ada_copy(ada_url input) noexcept {
14901+
ada::result<ada::url_aggregator>& r = get_instance(input);
14902+
return new ada::result<ada::url_aggregator>(r);
14903+
}
14904+
1489714905
bool ada_is_valid(ada_url result) noexcept {
1489814906
ada::result<ada::url_aggregator>& r = get_instance(result);
1489914907
return r.has_value();
@@ -15011,6 +15019,14 @@ ada_string ada_get_protocol(ada_url result) noexcept {
1501115019
return ada_string_create(out.data(), out.length());
1501215020
}
1501315021

15022+
uint8_t ada_get_url_host_type(ada_url result) noexcept {
15023+
ada::result<ada::url_aggregator>& r = get_instance(result);
15024+
if (!r) {
15025+
return 0;
15026+
}
15027+
return r->host_type;
15028+
}
15029+
1501415030
bool ada_set_href(ada_url result, const char* input, size_t length) noexcept {
1501515031
ada::result<ada::url_aggregator>& r = get_instance(result);
1501615032
if (!r) {

graal-nodejs/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 & {
@@ -6613,6 +6718,7 @@ struct url_search_params {
66136718
* @see https://url.spec.whatwg.org/#dom-urlsearchparams-has
66146719
*/
66156720
inline bool has(std::string_view key) noexcept;
6721+
inline bool has(std::string_view key, std::string_view value) noexcept;
66166722

66176723
/**
66186724
* @see https://url.spec.whatwg.org/#dom-urlsearchparams-set
@@ -6737,6 +6843,15 @@ inline bool url_search_params::has(const std::string_view key) noexcept {
67376843
return entry != params.end();
67386844
}
67396845

6846+
inline bool url_search_params::has(std::string_view key,
6847+
std::string_view value) noexcept {
6848+
auto entry =
6849+
std::find_if(params.begin(), params.end(), [&key, &value](auto &param) {
6850+
return param.first == key && param.second == value;
6851+
});
6852+
return entry != params.end();
6853+
}
6854+
67406855
inline std::string url_search_params::to_string() {
67416856
auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE;
67426857
std::string out{};
@@ -6811,14 +6926,14 @@ inline void url_search_params::sort() {
68116926
#ifndef ADA_ADA_VERSION_H
68126927
#define ADA_ADA_VERSION_H
68136928

6814-
#define ADA_VERSION "2.6.0"
6929+
#define ADA_VERSION "2.6.3"
68156930

68166931
namespace ada {
68176932

68186933
enum {
68196934
ADA_VERSION_MAJOR = 2,
68206935
ADA_VERSION_MINOR = 6,
6821-
ADA_VERSION_REVISION = 0,
6936+
ADA_VERSION_REVISION = 3,
68226937
};
68236938

68246939
} // namespace ada

graal-nodejs/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

graal-nodejs/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][]
12-
* [ada][]
12+
* [ada 2.6.3][]
1313
* [base64][]
1414
* [brotli][]
1515
* [c-ares][]
@@ -148,7 +148,7 @@ The [acorn](https://github.com/acornjs/acorn) dependency is a JavaScript parser.
148148
[acorn-walk](https://github.com/acornjs/acorn/tree/master/acorn-walk) is
149149
an abstract syntax tree walker for the ESTree format.
150150

151-
### ada
151+
### ada 2.6.3
152152

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

314314
[acorn]: #acorn
315-
[ada]: #ada
315+
[ada 2.6.3]: #ada-263
316316
[base64]: #base64
317317
[brotli]: #brotli
318318
[c-ares]: #c-ares

0 commit comments

Comments
 (0)