-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: url parser should throw error on invalid ipv4 #42915
Conversation
@nodejs/url |
It looks like this results in many other tests failing? |
Hi @Trott I'm trying to pinpoint the reason behind why the C++ code does not work. |
I'm not terribly familiar with that code or frankly C++ in general, plus I'm kinda occupied with other things right now, but a quick |
So, the problem was that when the parser saw more than 4 bool is_ipv4;
ParseIPv4Host(decoded.c_str(), decoded.length(), &is_ipv4);
if (is_ipv4)
return; Another big issue is around this line. Since, if parse number fails, it should also return a FAILURE, but before it should define is_ipv4 = true. int64_t n = ParseNumber(mark, pointer);
if (n < 0)
return; |
{ | ||
"input": "http://256.256.256.256.256.", | ||
"base": "http://other.com/", | ||
"failure": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/fixtures/wpt
should be updated using https://github.com/nodejs/node-core-utils/blob/main/docs/git-node.md#git-node-wpt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will introduce more failing tests. I've opened an additional issue in order to keep track of spec compliance and fix those issues.
@aduh95 can you re-run the failed test? |
Microscopic nit-pick on the commit message. Can be ignored (someone can fix it while landing if they feel strongly about it), but FYI for future stuff: First word should be an imperative verb (so an action). Instead of "should validate...", just "validate....". |
Thank you @Trott. You're absolutely right! I'll definitely take this feedback into consideration in my next commit. BTW, one of the test always goes to |
I haven't looked to see what test you are talking about specifically, but test reliability is definitely an issue we struggle with, so likely a common problem. |
PR-URL: nodejs#42915 Fixes: nodejs#42914 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Landed in 87d0d7a |
Thanks for the contribution! 🎉 |
Thanks @Trott! |
This PR changed quite a lot between the time I reviewed it and the time it landed, and #42915 (comment) looks like a blocker to me. I think we should revert. |
This reverts commit 87d0d7a. Refs: nodejs#42915
Fixes: #42914