Skip to content

Unsafe parsing of URLs #8747

Description

  • Version: 0.10.36
  • Platform: Mac OS X
  • Subsystem: url.parse

Some cases in which I would expect url.parse to behave differently:

IPv4 address

url.parse('1.2.3.4')={protocol: null,slashes: null,auth: null,host: null,port: null,hostname: null,// <- should be 1.2.3.4hash: null,search: null,query: null,pathname: '1.2.3.4',// <- no pathnamepath: '1.2.3.4',// <- no pathhref: '1.2.3.4'}

IPv4 address with port

url.parse('1.2.3.4:8080')={protocol: '1.2.3.4:',slashes: null,auth: null,host: '8080',// host is 1.2.3.4 not 8080port: null,// no porthostname: '8080',// host is 1.2.3.4 not 8080hash: null,search: null,query: null,pathname: null,path: null,href: '1.2.3.4:8080'}

IPv6 address

url.parse('::1')={protocol: null,slashes: null,auth: null,host: null,// should be ::1port: null,hostname: null,// should be ::1hash: null,search: null,query: null,pathname: '::1',// no pathnamepath: '::1',// no pathhref: '::1'}

IPv6 address with port

url.parse('::1:8080')={protocol: null,slashes: null,auth: null,host: null,// should be ::1port: null,// should be 8080hostname: null,// should be ::1hash: null,search: null,query: null,pathname: '::1:8080',// no pathnamepath: '::1:8080',// no pathhref: '::1:8080'}

Hostname

url.parse('asdf.com')={protocol: null,slashes: null,auth: null,host: null,// should be asdf.comport: null,hostname: null,// should be asdf.comhash: null,search: null,query: null,pathname: 'asdf.com',// no pathnamepath: 'asdf.com',// no pathhref: 'asdf.com'}

Hostname with port

url.parse('asdf.com:8080')={protocol: 'asdf.com:',slashes: null,auth: null,host: '8080',port: null,hostname: '8080',hash: null,search: null,query: null,pathname: null,path: null,href: 'asdf.com:8080'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    urlIssues and PRs related to the legacy built-in url module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions