@whatwg-node/node-fetch 0.7.6-alpha-20241227121459-e60dc5d611e0b845e709212dd1314922eb1935ca → 0.7.6-alpha-20241227121722-12cf66fa193e9b7d8a4f1b0456ec0c02d1bd0466

Sign up to get free protection for your applications and to get access to all the features.
package/cjs/URL.js CHANGED
@@ -18,11 +18,15 @@ class PonyfillURL extends fast_url_parser_1.default {
18
18
  return;
19
19
  }
20
20
  this.parse(url, false);
21
- // `fast-url-parser` cannot handle ipv6 hosts correctly
21
+ // `fast-url-parser` incorrectly removes `[IPV6]` in the hostname
22
+ // Then `hostname` doesn't include `[` and `]` for IPv6 URLs
23
+ // This breaks implementations that rely on `hostname` to include `[` and `]`
22
24
  if ((url.startsWith('http://[') || url.startsWith('https://[')) &&
23
25
  IPV6_REGEX.test(this.hostname)) {
24
26
  this.hostname = `[${this.hostname}]`;
25
27
  }
28
+ // `fast-url-parser` incorrectly handle URLs with ports without pathnames correctly like
29
+ // `http://localhost:8080?foo=bar` -> `http://localhost/:8080?foo=bar`
26
30
  if (url.includes(`${this.hostname}:`) && !this.port && this.pathname.startsWith('/:')) {
27
31
  this.port = this.pathname.slice(2);
28
32
  this.pathname = '/';
package/esm/URL.js CHANGED
@@ -14,11 +14,15 @@ export class PonyfillURL extends FastUrl {
14
14
  return;
15
15
  }
16
16
  this.parse(url, false);
17
- // `fast-url-parser` cannot handle ipv6 hosts correctly
17
+ // `fast-url-parser` incorrectly removes `[IPV6]` in the hostname
18
+ // Then `hostname` doesn't include `[` and `]` for IPv6 URLs
19
+ // This breaks implementations that rely on `hostname` to include `[` and `]`
18
20
  if ((url.startsWith('http://[') || url.startsWith('https://[')) &&
19
21
  IPV6_REGEX.test(this.hostname)) {
20
22
  this.hostname = `[${this.hostname}]`;
21
23
  }
24
+ // `fast-url-parser` incorrectly handle URLs with ports without pathnames correctly like
25
+ // `http://localhost:8080?foo=bar` -> `http://localhost/:8080?foo=bar`
22
26
  if (url.includes(`${this.hostname}:`) && !this.port && this.pathname.startsWith('/:')) {
23
27
  this.port = this.pathname.slice(2);
24
28
  this.pathname = '/';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.6-alpha-20241227121459-e60dc5d611e0b845e709212dd1314922eb1935ca",
3
+ "version": "0.7.6-alpha-20241227121722-12cf66fa193e9b7d8a4f1b0456ec0c02d1bd0466",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {