Skip to content

Commit 11ba859

Browse files
nodejs-github-botrichardlau
authored andcommittedMar 19, 2024··
deps: update ada to 2.7.6
PR-URL: #51542 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: LiviaMedeiros <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Daniel Lemire <[email protected]>
1 parent 73a946d commit 11ba859

File tree

2 files changed

+42
-22
lines changed

2 files changed

+42
-22
lines changed
 

‎deps/ada/ada.cpp

+35-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2024-01-22 09:15:53 -0500. Do not edit! */
1+
/* auto-generated on 2024-01-29 13:13:24 -0500. Do not edit! */
22
/* begin file src/ada.cpp */
33
#include "ada.h"
44
/* begin file src/checkers.cpp */
@@ -11221,7 +11221,7 @@ ada_warn_unused std::string to_string(ada::state state) {
1122111221
namespace ada {
1122211222

1122311223
bool url::parse_opaque_host(std::string_view input) {
11224-
ada_log("parse_opaque_host ", input, "[", input.size(), " bytes]");
11224+
ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
1122511225
if (std::any_of(input.begin(), input.end(),
1122611226
ada::unicode::is_forbidden_host_code_point)) {
1122711227
return is_valid = false;
@@ -11235,7 +11235,7 @@ bool url::parse_opaque_host(std::string_view input) {
1123511235
}
1123611236

1123711237
bool url::parse_ipv4(std::string_view input) {
11238-
ada_log("parse_ipv4 ", input, "[", input.size(), " bytes]");
11238+
ada_log("parse_ipv4 ", input, " [", input.size(), " bytes]");
1123911239
if (input.back() == '.') {
1124011240
input.remove_suffix(1);
1124111241
}
@@ -11310,7 +11310,7 @@ bool url::parse_ipv4(std::string_view input) {
1131011310
}
1131111311

1131211312
bool url::parse_ipv6(std::string_view input) {
11313-
ada_log("parse_ipv6 ", input, "[", input.size(), " bytes]");
11313+
ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
1131411314

1131511315
if (input.empty()) {
1131611316
return is_valid = false;
@@ -11634,7 +11634,7 @@ ada_really_inline bool url::parse_scheme(const std::string_view input) {
1163411634
}
1163511635

1163611636
ada_really_inline bool url::parse_host(std::string_view input) {
11637-
ada_log("parse_host ", input, "[", input.size(), " bytes]");
11637+
ada_log("parse_host ", input, " [", input.size(), " bytes]");
1163811638
if (input.empty()) {
1163911639
return is_valid = false;
1164011640
} // technically unnecessary.
@@ -11686,6 +11686,8 @@ ada_really_inline bool url::parse_host(std::string_view input) {
1168611686
ada_log("parse_host to_ascii returns false");
1168711687
return is_valid = false;
1168811688
}
11689+
ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
11690+
" bytes]");
1168911691

1169011692
if (std::any_of(host.value().begin(), host.value().end(),
1169111693
ada::unicode::is_forbidden_domain_code_point)) {
@@ -11696,7 +11698,7 @@ ada_really_inline bool url::parse_host(std::string_view input) {
1169611698
// If asciiDomain ends in a number, then return the result of IPv4 parsing
1169711699
// asciiDomain.
1169811700
if (checkers::is_ipv4(host.value())) {
11699-
ada_log("parse_host got ipv4", *host);
11701+
ada_log("parse_host got ipv4 ", *host);
1170011702
return parse_ipv4(host.value());
1170111703
}
1170211704

@@ -13571,7 +13573,7 @@ void url_aggregator::set_hash(const std::string_view input) {
1357113573

1357213574
bool url_aggregator::set_href(const std::string_view input) {
1357313575
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
13574-
ada_log("url_aggregator::set_href ", input, "[", input.size(), " bytes]");
13576+
ada_log("url_aggregator::set_href ", input, " [", input.size(), " bytes]");
1357513577
ada::result<url_aggregator> out = ada::parse<url_aggregator>(input);
1357613578
ada_log("url_aggregator::set_href, success :", out.has_value());
1357713579

@@ -13585,7 +13587,8 @@ bool url_aggregator::set_href(const std::string_view input) {
1358513587
}
1358613588

1358713589
ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
13588-
ada_log("url_aggregator:parse_host ", input, "[", input.size(), " bytes]");
13590+
ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
13591+
" bytes]");
1358913592
ADA_ASSERT_TRUE(validate());
1359013593
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
1359113594
if (input.empty()) {
@@ -13635,7 +13638,7 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
1363513638
update_base_hostname(input);
1363613639
if (checkers::is_ipv4(get_hostname())) {
1363713640
ada_log("parse_host fast path ipv4");
13638-
return parse_ipv4(get_hostname());
13641+
return parse_ipv4(get_hostname(), true);
1363913642
}
1364013643
ada_log("parse_host fast path ", get_hostname());
1364113644
return true;
@@ -13651,6 +13654,8 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
1365113654
ada_log("parse_host to_ascii returns false");
1365213655
return is_valid = false;
1365313656
}
13657+
ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
13658+
" bytes]");
1365413659

1365513660
if (std::any_of(host.value().begin(), host.value().end(),
1365613661
ada::unicode::is_forbidden_domain_code_point)) {
@@ -13660,8 +13665,8 @@ ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
1366013665
// If asciiDomain ends in a number, then return the result of IPv4 parsing
1366113666
// asciiDomain.
1366213667
if (checkers::is_ipv4(host.value())) {
13663-
ada_log("parse_host got ipv4", *host);
13664-
return parse_ipv4(host.value());
13668+
ada_log("parse_host got ipv4 ", *host);
13669+
return parse_ipv4(host.value(), false);
1366513670
}
1366613671

1366713672
update_base_hostname(host.value());
@@ -13914,7 +13919,7 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1391413919
}
1391513920

1391613921
[[nodiscard]] std::string ada::url_aggregator::to_string() const {
13917-
ada_log("url_aggregator::to_string buffer:", buffer, "[", buffer.size(),
13922+
ada_log("url_aggregator::to_string buffer:", buffer, " [", buffer.size(),
1391813923
" bytes]");
1391913924
if (!is_valid) {
1392013925
return "null";
@@ -14013,8 +14018,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1401314018
return checkers::verify_dns_length(get_hostname());
1401414019
}
1401514020

14016-
bool url_aggregator::parse_ipv4(std::string_view input) {
14017-
ada_log("parse_ipv4 ", input, "[", input.size(),
14021+
bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
14022+
ada_log("parse_ipv4 ", input, " [", input.size(),
1401814023
" bytes], overlaps with buffer: ",
1401914024
helpers::overlaps(input, buffer) ? "yes" : "no");
1402014025
ADA_ASSERT_TRUE(validate());
@@ -14038,20 +14043,25 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
1403814043
} else {
1403914044
std::from_chars_result r;
1404014045
if (is_hex) {
14046+
ada_log("parse_ipv4 trying to parse hex number");
1404114047
r = std::from_chars(input.data() + 2, input.data() + input.size(),
1404214048
segment_result, 16);
1404314049
} else if ((input.length() >= 2) && input[0] == '0' &&
1404414050
checkers::is_digit(input[1])) {
14051+
ada_log("parse_ipv4 trying to parse octal number");
1404514052
r = std::from_chars(input.data() + 1, input.data() + input.size(),
1404614053
segment_result, 8);
1404714054
} else {
14055+
ada_log("parse_ipv4 trying to parse decimal number");
1404814056
pure_decimal_count++;
1404914057
r = std::from_chars(input.data(), input.data() + input.size(),
1405014058
segment_result, 10);
1405114059
}
1405214060
if (r.ec != std::errc()) {
14061+
ada_log("parse_ipv4 parsing failed");
1405314062
return is_valid = false;
1405414063
}
14064+
ada_log("parse_ipv4 parsed ", segment_result);
1405514065
input.remove_prefix(r.ptr - input.data());
1405614066
}
1405714067
if (input.empty()) {
@@ -14076,17 +14086,22 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
1407614086
}
1407714087
}
1407814088
if ((digit_count != 4) || (!input.empty())) {
14089+
ada_log("parse_ipv4 found invalid (more than 4 numbers or empty) ");
1407914090
return is_valid = false;
1408014091
}
1408114092
final:
1408214093
ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
1408314094
" host: ", get_host());
1408414095

1408514096
// We could also check r.ptr to see where the parsing ended.
14086-
if (pure_decimal_count == 4 && !trailing_dot) {
14097+
if (in_place && pure_decimal_count == 4 && !trailing_dot) {
14098+
ada_log(
14099+
"url_aggregator::parse_ipv4 completed and was already correct in the "
14100+
"buffer");
1408714101
// The original input was already all decimal and we validated it. So we
1408814102
// don't need to do anything.
1408914103
} else {
14104+
ada_log("url_aggregator::parse_ipv4 completed and we need to update it");
1409014105
// Optimization opportunity: Get rid of unnecessary string return in ipv4
1409114106
// serializer.
1409214107
// TODO: This is likely a bug because it goes back update_base_hostname, not
@@ -14100,8 +14115,11 @@ bool url_aggregator::parse_ipv4(std::string_view input) {
1410014115
}
1410114116

1410214117
bool url_aggregator::parse_ipv6(std::string_view input) {
14118+
// TODO: Implement in_place optimization: we know that input points
14119+
// in the buffer, so we can just check whether the buffer is already
14120+
// well formatted.
1410314121
// TODO: Find a way to merge parse_ipv6 with url.cpp implementation.
14104-
ada_log("parse_ipv6 ", input, "[", input.size(), " bytes]");
14122+
ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
1410514123
ADA_ASSERT_TRUE(validate());
1410614124
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
1410714125
if (input.empty()) {
@@ -14335,7 +14353,7 @@ bool url_aggregator::parse_ipv6(std::string_view input) {
1433514353
}
1433614354

1433714355
bool url_aggregator::parse_opaque_host(std::string_view input) {
14338-
ada_log("parse_opaque_host ", input, "[", input.size(), " bytes]");
14356+
ada_log("parse_opaque_host ", input, " [", input.size(), " bytes]");
1433914357
ADA_ASSERT_TRUE(validate());
1434014358
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
1434114359
if (std::any_of(input.begin(), input.end(),

‎deps/ada/ada.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2024-01-22 09:15:53 -0500. Do not edit! */
1+
/* auto-generated on 2024-01-29 13:13:24 -0500. Do not edit! */
22
/* begin file include/ada.h */
33
/**
44
* @file ada.h
@@ -4868,10 +4868,12 @@ struct url_aggregator : url_base {
48684868
}
48694869

48704870
/**
4871-
* Return true on success.
4871+
* Return true on success. The 'in_place' parameter indicates whether the
4872+
* the string_view input is pointing in the buffer. When in_place is false,
4873+
* we must nearly always update the buffer.
48724874
* @see https://url.spec.whatwg.org/#concept-ipv4-parser
48734875
*/
4874-
[[nodiscard]] bool parse_ipv4(std::string_view input);
4876+
[[nodiscard]] bool parse_ipv4(std::string_view input, bool in_place);
48754877

48764878
/**
48774879
* Return true on success.
@@ -7078,14 +7080,14 @@ url_search_params_entries_iter::next() {
70787080
#ifndef ADA_ADA_VERSION_H
70797081
#define ADA_ADA_VERSION_H
70807082

7081-
#define ADA_VERSION "2.7.5"
7083+
#define ADA_VERSION "2.7.6"
70827084

70837085
namespace ada {
70847086

70857087
enum {
70867088
ADA_VERSION_MAJOR = 2,
70877089
ADA_VERSION_MINOR = 7,
7088-
ADA_VERSION_REVISION = 5,
7090+
ADA_VERSION_REVISION = 6,
70897091
};
70907092

70917093
} // namespace ada

0 commit comments

Comments
 (0)
Please sign in to comment.