In version 0.12.0, url.parse() does not parse a URL containing an IPv6 link-local address correctly.
Specifically, adding a zone to the address in the host portion of the URL causes url.parse() to fail to detect the host portion of the address and considers everything after the protocol to be part of the path.
Example of failure with IPv6 zone:
var url = require('url');
url.parse('ws://[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/?EIO=3&transport=websocket');
{ protocol: 'ws:',
slashes: true,
auth: null,
host: '',
port: null,
hostname: '',
hash: null,
search: '?EIO=3&transport=websocket',
query: 'EIO=3&transport=websocket',
pathname: '/[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/',
path: '/[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/?EIO=3&transport=websocket',
href: 'ws:///[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/?EIO=3&transport=websocket' }
Example of success without the IPv6 zone:
var url = require('url');
url.parse('ws://[fe80::2e0:4cff:fe68:23ff]:51877/engine.io/?EIO=3&transport=websocket');
{ protocol: 'ws:',
slashes: true,
auth: null,
host: '[fe80::2e0:4cff:fe68:23ff]:51877',
port: '51877',
hostname: 'fe80::2e0:4cff:fe68:23ff',
hash: null,
search: '?EIO=3&transport=websocket',
query: 'EIO=3&transport=websocket',
pathname: '/engine.io/',
path: '/engine.io/?EIO=3&transport=websocket',
href: 'ws://[fe80::2e0:4cff:fe68:23ff]:51877/engine.io/?EIO=3&transport=websocket' }
Expected behavior
I would expect url.parse() of ws://[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/?EIO=3&transport=websocket to produce the following result:
{ protocol: 'ws:',
slashes: true,
auth: null,
host: '[fe80::2e0:4cff:fe68:23ff%en7]:51877',
port: 51877,
hostname: 'fe80::2e0:4cff:fe68:23ff%en7',
hash: null,
search: '?EIO=3&transport=websocket',
query: 'EIO=3&transport=websocket',
pathname: '/engine.io/',
path: '/engine.io/?EIO=3&transport=websocket',
href: 'ws://[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/?EIO=3&transport=websocket' }
In version 0.12.0,
url.parse()does not parse a URL containing an IPv6 link-local address correctly.Specifically, adding a zone to the address in the host portion of the URL causes
url.parse()to fail to detect the host portion of the address and considers everything after the protocol to be part of the path.Example of failure with IPv6 zone:
Example of success without the IPv6 zone:
Expected behavior
I would expect
url.parse()ofws://[fe80::2e0:4cff:fe68:23ff%en7]:51877/engine.io/?EIO=3&transport=websocketto produce the following result: