tough-cookie 2.4.2 → 2.4.3
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/README.md +2 -2
- package/lib/cookie.js +7 -0
- package/lib/memstore.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ Transforms a domain-name into a canonical domain-name. The canonical domain-nam
|
|
|
57
57
|
|
|
58
58
|
Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain-name and the `domStr` is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match".
|
|
59
59
|
|
|
60
|
-
The `canonicalize` parameter will run the other two
|
|
60
|
+
The `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.
|
|
61
61
|
|
|
62
62
|
### `defaultPath(path)`
|
|
63
63
|
|
|
@@ -186,7 +186,7 @@ sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity`
|
|
|
186
186
|
|
|
187
187
|
expiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.
|
|
188
188
|
|
|
189
|
-
Max-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now`
|
|
189
|
+
Max-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.
|
|
190
190
|
|
|
191
191
|
If Expires (`.expires`) is set, that's returned.
|
|
192
192
|
|
package/lib/cookie.js
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
'use strict';
|
|
32
32
|
var net = require('net');
|
|
33
33
|
var urlParse = require('url').parse;
|
|
34
|
+
var util = require('util');
|
|
34
35
|
var pubsuffix = require('./pubsuffix-psl');
|
|
35
36
|
var Store = require('./store').Store;
|
|
36
37
|
var MemoryCookieStore = require('./memstore').MemoryCookieStore;
|
|
@@ -756,6 +757,12 @@ Cookie.prototype.inspect = function inspect() {
|
|
|
756
757
|
'"';
|
|
757
758
|
};
|
|
758
759
|
|
|
760
|
+
// Use the new custom inspection symbol to add the custom inspect function if
|
|
761
|
+
// available.
|
|
762
|
+
if (util.inspect.custom) {
|
|
763
|
+
Cookie.prototype[util.inspect.custom] = Cookie.prototype.inspect;
|
|
764
|
+
}
|
|
765
|
+
|
|
759
766
|
Cookie.prototype.toJSON = function() {
|
|
760
767
|
var obj = {};
|
|
761
768
|
|
package/lib/memstore.js
CHANGED
|
@@ -50,6 +50,12 @@ MemoryCookieStore.prototype.inspect = function() {
|
|
|
50
50
|
return "{ idx: "+util.inspect(this.idx, false, 2)+' }';
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
// Use the new custom inspection symbol to add the custom inspect function if
|
|
54
|
+
// available.
|
|
55
|
+
if (util.inspect.custom) {
|
|
56
|
+
MemoryCookieStore.prototype[util.inspect.custom] = MemoryCookieStore.prototype.inspect;
|
|
57
|
+
}
|
|
58
|
+
|
|
53
59
|
MemoryCookieStore.prototype.findCookie = function(domain, path, key, cb) {
|
|
54
60
|
if (!this.idx[domain]) {
|
|
55
61
|
return cb(null,undefined);
|