tough-cookie 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -928,7 +928,7 @@ declare class ParameterError extends Error {
928
928
  * The version of `tough-cookie`
929
929
  * @public
930
930
  */
931
- declare const version = "6.0.1";
931
+ declare const version = "6.0.2";
932
932
 
933
933
  /**
934
934
  * Transforms a domain name into a canonical domain name. The canonical domain name is a domain name
@@ -1699,6 +1699,10 @@ declare function defaultPath(path?: Nullable<string>): string;
1699
1699
  * but it helps to think of it as a "suffix match".
1700
1700
  *
1701
1701
  * @remarks
1702
+ * This implementation is compliant with RFC6265 Section 5.1.3 and compatible with
1703
+ * {@link https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-22#section-5.1.3 | draft-ietf-httpbis-rfc6265bis-22}
1704
+ * which adds a clarifying note that both inputs must be canonicalized but is otherwise identical.
1705
+ *
1702
1706
  * ### 5.1.3. Domain Matching
1703
1707
  *
1704
1708
  * A string domain-matches a given domain string if at least one of the
package/dist/index.d.ts CHANGED
@@ -928,7 +928,7 @@ declare class ParameterError extends Error {
928
928
  * The version of `tough-cookie`
929
929
  * @public
930
930
  */
931
- declare const version = "6.0.1";
931
+ declare const version = "6.0.2";
932
932
 
933
933
  /**
934
934
  * Transforms a domain name into a canonical domain name. The canonical domain name is a domain name
@@ -1699,6 +1699,10 @@ declare function defaultPath(path?: Nullable<string>): string;
1699
1699
  * but it helps to think of it as a "suffix match".
1700
1700
  *
1701
1701
  * @remarks
1702
+ * This implementation is compliant with RFC6265 Section 5.1.3 and compatible with
1703
+ * {@link https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-22#section-5.1.3 | draft-ietf-httpbis-rfc6265bis-22}
1704
+ * which adds a clarifying note that both inputs must be canonicalized but is otherwise identical.
1705
+ *
1702
1706
  * ### 5.1.3. Domain Matching
1703
1707
  *
1704
1708
  * A string domain-matches a given domain string if at least one of the
package/dist/index.js CHANGED
@@ -384,7 +384,7 @@ var ParameterError = class extends Error {
384
384
  };
385
385
 
386
386
  // lib/version.ts
387
- var version = "6.0.1";
387
+ var version = "6.0.2";
388
388
 
389
389
  // lib/cookie/constants.ts
390
390
  var PrefixSecurityEnum = {
@@ -1342,17 +1342,23 @@ function getCookieContext(url) {
1342
1342
  protocol: url.protocol
1343
1343
  };
1344
1344
  } else if (typeof url === "string") {
1345
+ const parsed = new URL(url);
1346
+ let pathname = parsed.pathname;
1345
1347
  try {
1346
- return new URL(decodeURI(url));
1348
+ pathname = decodeURI(pathname);
1347
1349
  } catch {
1348
- return new URL(url);
1349
1350
  }
1351
+ return {
1352
+ hostname: parsed.hostname,
1353
+ pathname,
1354
+ protocol: parsed.protocol
1355
+ };
1350
1356
  } else {
1351
1357
  throw new ParameterError("`url` argument is not a string or URL.");
1352
1358
  }
1353
1359
  }
1354
1360
  function checkSameSiteContext(value) {
1355
- const context = String(value).toLowerCase();
1361
+ const context = value.toLowerCase();
1356
1362
  if (context === "none" || context === "lax" || context === "strict") {
1357
1363
  return context;
1358
1364
  } else {