Open perrin4869 opened 1 month ago
https://github.com/ladjs/superagent/pull/1803 broke the parsing of ipv6 addresses such as http://[::]:80. Before that PR, using node:url, we would get:
http://[::]:80
node:url
> const { parse } = require("node:url") undefined > parse("http://[::]:80") Url { protocol: 'http:', slashes: true, auth: null, host: '[::]:80', port: '80', hostname: '::', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://[::]:80/' }
With the URL class, however, the hostname becomes:
URL
hostname
> new URL("http://[::]:80") URL { href: 'http://[::]/', origin: 'http://[::]', protocol: 'http:', username: '', password: '', host: '[::]', hostname: '[::]', port: '', pathname: '/', search: '', searchParams: URLSearchParams {}, hash: '' }
This hostname [::] is not compatible with the http.request function. I added some normalization functionality here to return the previous behavior.
[::]
http.request
Edit: hm... it is a bit hard to add regression tests here, since all the tests seem to run against a single server that doesn't seem to listen on [::]
Can confirm. This broke in 9.0.2 .
If you can get the tests to pass I can merge
ok, I managed to add some regression tests! they don't seem to work on http2 so I disabled those
https://github.com/ladjs/superagent/pull/1803 broke the parsing of ipv6 addresses such as
http://[::]:80
. Before that PR, usingnode:url
, we would get:With the
URL
class, however, thehostname
becomes:This hostname
[::]
is not compatible with thehttp.request
function. I added some normalization functionality here to return the previous behavior.Edit: hm... it is a bit hard to add regression tests here, since all the tests seem to run against a single server that doesn't seem to listen on
[::]