mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-11-22 05:25:29 +07:00
node_modules: update
This commit is contained in:
1 parent
0989b5499d
commit
a20949df3b
21 files changed
+129
-34
No files matched your search
+3
-1
@@ -71,7 +71,9 @@ declare class Cookies {
|
||||
*/
|
||||
add(cookie: Cookie): boolean;
|
||||
/**
|
||||
* Checks if two cookie objects are the same
|
||||
* Checks if two cookie objects are the same cookie. A cookie is identified by its
|
||||
* name, domain and path (RFC 6265 section 5.3), the Secure and HttpOnly flags are
|
||||
* attributes of the stored cookie that an update replaces
|
||||
*
|
||||
* @param a Cookie to check against
|
||||
* @param b Cookie to check against
|
||||
|
||||
+12
-3
@@ -51,6 +51,10 @@ class Cookies {
|
||||
if (!cookie.expires) {
|
||||
cookie.expires = new Date(Date.now() + (Number(this.options.sessionTimeout || SESSION_TIMEOUT) || SESSION_TIMEOUT) * 1000);
|
||||
}
|
||||
// a non-secure url can not set a Secure cookie, nor overwrite or delete one (RFC 6265bis section 5.7)
|
||||
if (urlparts.protocol !== 'https:' && (cookie.secure || this.cookies.some(stored => stored.secure && this.compare(stored, cookie)))) {
|
||||
return false;
|
||||
}
|
||||
return this.add(cookie);
|
||||
}
|
||||
/**
|
||||
@@ -93,6 +97,7 @@ class Cookies {
|
||||
parse(cookieStr) {
|
||||
const cookie = {};
|
||||
let hasNameValue = false;
|
||||
let hasMaxAge = false;
|
||||
(cookieStr || '')
|
||||
.toString()
|
||||
.split(';')
|
||||
@@ -120,7 +125,8 @@ class Cookies {
|
||||
case 'expires': {
|
||||
const expires = new Date(value);
|
||||
// ignore date if can not parse it
|
||||
if (expires.toString() !== 'Invalid Date') {
|
||||
if (expires.toString() !== 'Invalid Date' && !hasMaxAge) {
|
||||
// Max-Age has precedence when both attributes are present (RFC 6265 5.3)
|
||||
cookie.expires = expires;
|
||||
}
|
||||
break;
|
||||
@@ -137,6 +143,7 @@ class Cookies {
|
||||
break;
|
||||
case 'max-age':
|
||||
cookie.expires = new Date(Date.now() + (Number(value) || 0) * 1000);
|
||||
hasMaxAge = true;
|
||||
break;
|
||||
case 'secure':
|
||||
cookie.secure = true;
|
||||
@@ -206,14 +213,16 @@ class Cookies {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Checks if two cookie objects are the same
|
||||
* Checks if two cookie objects are the same cookie. A cookie is identified by its
|
||||
* name, domain and path (RFC 6265 section 5.3), the Secure and HttpOnly flags are
|
||||
* attributes of the stored cookie that an update replaces
|
||||
*
|
||||
* @param a Cookie to check against
|
||||
* @param b Cookie to check against
|
||||
* @returns True, if the cookies are the same
|
||||
*/
|
||||
compare(a, b) {
|
||||
return a.name === b.name && a.path === b.path && a.domain === b.domain && a.secure === b.secure && a.httponly === b.httponly;
|
||||
return a.name === b.name && a.path === b.path && a.domain === b.domain;
|
||||
}
|
||||
/**
|
||||
* Checks if a cookie is expired
|
||||
|
||||
Reference in new issue
Block a user