Closed

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.4
hash: null,
search: null,
query: null,
pathname: '1.2.3.4', // <- no pathname
path: '1.2.3.4', // <- no path
href: '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 8080
port: null, // no port
hostname: '8080', // host is 1.2.3.4 not 8080
hash: 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 ::1
port: null,
hostname: null, // should be ::1
hash: null,
search: null,
query: null,
pathname: '::1', // no pathname
path: '::1', // no path
href: '::1'
}
IPv6 address with port
url.parse('::1:8080') = {
protocol: null,
slashes: null,
auth: null,
host: null, // should be ::1
port: null, // should be 8080
hostname: null, // should be ::1
hash: null,
search: null,
query: null,
pathname: '::1:8080', // no pathname
path: '::1:8080', // no path
href: '::1:8080'
}
Hostname
url.parse('asdf.com') = {
protocol: null,
slashes: null,
auth: null,
host: null, // should be asdf.com
port: null,
hostname: null, // should be asdf.com
hash: null,
search: null,
query: null,
pathname: 'asdf.com', // no pathname
path: 'asdf.com', // no path
href: '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'
}