Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tough-cookie

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tough-cookie - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

lib/pathMatch.js

65

lib/cookie.js

@@ -36,2 +36,4 @@ /*!

var Store = require('./store').Store;
var MemoryCookieStore = require('./memstore').MemoryCookieStore;
var pathMatch = require('./pathMatch').pathMatch;

@@ -317,31 +319,3 @@ var punycode;

/*
* "A request-path path-matches a given cookie-path if at least one of the
* following conditions holds:"
*/
function pathMatch(reqPath,cookiePath) {
// "o The cookie-path and the request-path are identical."
if (cookiePath === reqPath) {
return true;
}
var idx = reqPath.indexOf(cookiePath);
if (idx === 0) {
// "o The cookie-path is a prefix of the request-path, and the last
// character of the cookie-path is %x2F ("/")."
if (cookiePath.substr(-1) === "/") {
return true;
}
// " o The cookie-path is a prefix of the request-path, and the first
// character of the request-path that is not included in the cookie- path
// is a %x2F ("/") character."
if (reqPath.substr(cookiePath.length,1) === "/") {
return true;
}
}
return false;
}
function parse(str) {

@@ -562,24 +536,2 @@ str = str.trim();

// Gives the permutation of all possible domainMatch()es of a given domain. The
// array is in shortest-to-longest order. Handy for indexing.
function permuteDomain(domain) {
var pubSuf = pubsuffix.getPublicSuffix(domain);
if (!pubSuf) {
return null;
}
if (pubSuf == domain) {
return [domain];
}
var prefix = domain.slice(0,-(pubSuf.length+1)); // ".example.com"
var parts = prefix.split('.').reverse();
var cur = pubSuf;
var permutations = [cur];
while (parts.length) {
cur = parts.shift()+'.'+cur;
permutations.push(cur);
}
return permutations;
}
// Gives the permutation of all possible pathMatch()es of a given path. The

@@ -608,5 +560,5 @@ // array is in longest-to-shortest order. Handy for indexing.

function getCookieContext(url) {
if(url instanceof Object)
if (url instanceof Object) {
return url;
}
// NOTE: decodeURI will throw on malformed URIs (see GH-32).

@@ -679,3 +631,3 @@ // Therefore, we will just skip decoding for such URIs.

}
if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires,true)) {
if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires)) {
return false;

@@ -839,3 +791,2 @@ }

var memstore;
function CookieJar(store, rejectPublicSuffixes) {

@@ -847,4 +798,3 @@ if (rejectPublicSuffixes != null) {

if (!store) {
memstore = memstore || require('./memstore');
store = new memstore.MemoryCookieStore();
store = new MemoryCookieStore();
}

@@ -1132,2 +1082,3 @@ this.store = store;

Store: Store,
MemoryCookieStore: MemoryCookieStore,
parseDate: parseDate,

@@ -1142,5 +1093,5 @@ formatDate: formatDate,

cookieCompare: cookieCompare,
permuteDomain: permuteDomain,
permuteDomain: require('./permuteDomain').permuteDomain,
permutePath: permutePath,
canonicalDomain: canonicalDomain
};

@@ -32,6 +32,5 @@ /*!

'use strict';
var tough = require('./cookie');
var Store = require('./store').Store;
var permuteDomain = tough.permuteDomain;
var pathMatch = tough.pathMatch;
var permuteDomain = require('./permuteDomain').permuteDomain;
var pathMatch = require('./pathMatch').pathMatch;
var util = require('util');

@@ -38,0 +37,0 @@

@@ -16,3 +16,3 @@ {

],
"version": "1.1.0",
"version": "1.2.0",
"homepage": "https://github.com/SalesforceEng/tough-cookie",

@@ -19,0 +19,0 @@ "repository": {

@@ -31,4 +31,2 @@ [RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js

Requires `punycode`, which should get installed automatically for you. Note that node.js v0.6.2+ bundles punycode by default.
Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.

@@ -379,12 +377,13 @@

Removes matching cookies from the store. The `path` paramter is optional, and if missing means all paths in a domain should be removed.
Removes matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.
Pass an error ONLY if removing any existing cookies failed.
# TODO
MemoryCookieStore
=================
* _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()`
* the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891
* better tests for `validate()`?
Inherits from Store.
Just-in-memory CookieJar synchronous store implementation, used by default.
# Copyright and License

@@ -391,0 +390,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc