Skip to content

"URL.parse()" works differently in diff versions of Nodejs #49024

Closed
@SEWeiTung

Description

@SEWeiTung

Version

18.17.0 or 18.16.X

Platform

N/A (including Windows, Mac and Linux)

Subsystem

N/A

What steps will reproduce the bug?

  1. Open any dev env.
  2. Write a very simple code, something like this:
const URL = require('url');
const result = URL.parse('dubbo://300.149.250.173:20880/demo.DemoService?anyhost=true&application=demo-provider&dubbo=2.0.0&generic=false&interface=demo.DemoService&loadbalance=roundrobin&methods=sayHello&owner=william&pid=81281&side=provider&timestamp=1481613276143');

How often does it reproduce? Is there a required condition?

Always,without a required condition

What is the expected behavior? Why is that the expected behavior?

Works properly as what we see in the previous version (Before Node 18.17.0、18.16.X, it works fine without any exceptions).

What do you see instead?

TypeError [ERR_INVALID_URL]: Invalid URL\n' +
' at new NodeError (node:internal/errors:405:5)\n' +
' at Url.parse (node:url:445:17)\n' +
' at new urlParse (node:url:167:13)\n'

Additional information

  1. This ONLY happens in Nodejs since 18.17.0 or 18.16.X, I cannot reproduce it any more in the other versions of Nodejs (Even in the previous versions of Nodejs like "18.14.X", we cannot reproduce it.....

  2. When I change "300.149.250.173" to "www.randomAddress.com", everything works fine, why (I mean it seems I cannot use numeric address but Latin-based address....)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    urlIssues and PRs related to the legacy built-in url module.v18.xIssues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions