From 8fc42d31a5e0a9d1a0610744e2f39f66648e7a9d Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 5 May 2022 13:41:35 +0200 Subject: [PATCH] url: revert "validate ipv4 part length" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 87d0d7a069b2a3ca1db1dd592a62db4645ba5d69. Refs: https://github.com/nodejs/node/pull/42915 PR-URL: https://github.com/nodejs/node/pull/42940 Reviewed-By: Michaël Zasso Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Rich Trott --- src/node_url.cc | 6 +----- .../fixtures/wpt/url/resources/urltestdata.json | 17 +++++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/node_url.cc b/src/node_url.cc index dbb51ef5ec00af..3cbe6ab5f354e2 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -411,11 +411,7 @@ void URLHost::ParseIPv4Host(const char* input, size_t length, bool* is_ipv4) { const char ch = pointer < end ? pointer[0] : kEOL; int64_t remaining = end - pointer - 1; if (ch == '.' || ch == kEOL) { - // If parts’s size is greater than 4, validation error, return failure. - if (++parts > static_cast(arraysize(numbers))) { - *is_ipv4 = true; - return; - } + if (++parts > static_cast(arraysize(numbers))) return; if (pointer == mark) return; int64_t n = ParseNumber(mark, pointer); diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index dc33048964a2f5..a56b30caf98cb1 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -5317,12 +5317,17 @@ { "input": "http://256.256.256.256.256", "base": "http://other.com/", - "failure": true - }, - { - "input": "http://256.256.256.256.256.", - "base": "http://other.com/", - "failure": true + "href": "http://256.256.256.256.256/", + "origin": "http://256.256.256.256.256", + "protocol": "http:", + "username": "", + "password": "", + "host": "256.256.256.256.256", + "hostname": "256.256.256.256.256", + "port": "", + "pathname": "/", + "search": "", + "hash": "" }, { "input": "https://0x.0x.0",