Skip to content

Commit a3ff4bf

Browse files
authored
url: revert "validate ipv4 part length"
This reverts commit 87d0d7a. Refs: #42915 PR-URL: #42940 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f7d658a commit a3ff4bf

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/node_url.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,7 @@ void URLHost::ParseIPv4Host(const char* input, size_t length, bool* is_ipv4) {
411411
const char ch = pointer < end ? pointer[0] : kEOL;
412412
int64_t remaining = end - pointer - 1;
413413
if (ch == '.' || ch == kEOL) {
414-
// If parts’s size is greater than 4, validation error, return failure.
415-
if (++parts > static_cast<int>(arraysize(numbers))) {
416-
*is_ipv4 = true;
417-
return;
418-
}
414+
if (++parts > static_cast<int>(arraysize(numbers))) return;
419415
if (pointer == mark)
420416
return;
421417
int64_t n = ParseNumber(mark, pointer);

test/fixtures/wpt/url/resources/urltestdata.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -5317,12 +5317,17 @@
53175317
{
53185318
"input": "http://256.256.256.256.256",
53195319
"base": "http://other.com/",
5320-
"failure": true
5321-
},
5322-
{
5323-
"input": "http://256.256.256.256.256.",
5324-
"base": "http://other.com/",
5325-
"failure": true
5320+
"href": "http://256.256.256.256.256/",
5321+
"origin": "http://256.256.256.256.256",
5322+
"protocol": "http:",
5323+
"username": "",
5324+
"password": "",
5325+
"host": "256.256.256.256.256",
5326+
"hostname": "256.256.256.256.256",
5327+
"port": "",
5328+
"pathname": "/",
5329+
"search": "",
5330+
"hash": ""
53265331
},
53275332
{
53285333
"input": "https://0x.0x.0",

0 commit comments

Comments
 (0)