cookiejar
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -70,7 +70,18 @@ /* jshint node: true */ | ||
return !!value; | ||
}), | ||
pair = parts[0].match(/([^=]+)=([\s\S]*)/), | ||
key = pair[1], | ||
value = pair[2], | ||
i; | ||
}); | ||
var i; | ||
var pair = parts[0].match(/([^=]+)=([\s\S]*)/); | ||
if (!pair) { | ||
console.warn("Invalid cookie header encountered. Header: '"+str+"'"); | ||
return; | ||
} | ||
var key = pair[1]; | ||
var value = pair[2]; | ||
if ( typeof key !== 'string' || key.length === 0 || typeof value !== 'string' ) { | ||
console.warn("Unable to extract values from cookie header. Cookie: '"+str+"'"); | ||
return; | ||
} | ||
this.name = key; | ||
@@ -77,0 +88,0 @@ this.value = value; |
{ | ||
"name": "cookiejar", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"author": { | ||
@@ -22,4 +22,4 @@ "name": "bradleymeck" | ||
"devDependencies": { | ||
"jshint": "^2.8.0" | ||
"jshint": "^2.9.4" | ||
} | ||
} |
# CookieJar | ||
[![NPM version](http://img.shields.io/npm/v/cookiejar.svg)](https://www.npmjs.org/package/cookiejar) | ||
[![devDependency Status](https://david-dm.org/bmeck/node-cookiejar/dev-status.svg)](https://david-dm.org/bmeck/node-cookiejar?type=dev) | ||
Simple robust cookie library | ||
@@ -9,3 +12,3 @@ | ||
class to determine matching qualities of a cookie | ||
class to determine matching qualities of a cookie | ||
@@ -22,7 +25,7 @@ ##### Properties | ||
turns input into a Cookie (singleton if given a Cookie) | ||
the `request_domain` argument is used to default the domain if it is not explicit in the cookie string | ||
the `request_path` argument is used to set the path if it is not explicit in a cookie String. | ||
It turns input into a Cookie (singleton if given a Cookie), | ||
the `request_domain` argument is used to default the domain if it is not explicit in the cookie string, | ||
the `request_path` argument is used to set the path if it is not explicit in a cookie String. | ||
explicit domains/paths will cascade, implied domains/paths must *exactly* match (see http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Pat) | ||
Explicit domains/paths will cascade, implied domains/paths must *exactly* match (see http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Pat). | ||
@@ -43,7 +46,7 @@ ##### Properties | ||
* String toString() - the __set-cookie:__ string for this cookie | ||
* String toValueString() - the __cookie:__ string for this cookie | ||
* Cookie parse(cookiestr, request_domain, request_path) - parses the string onto this cookie or a new one if called directly | ||
* Boolean matches(access_info) - returns true if the access_info allows retrieval of this cookie | ||
* Boolean collidesWith(cookie) - returns true if the cookies cannot exist in the same space (domain and path match) | ||
* `String toString()` - the __set-cookie:__ string for this cookie | ||
* `String toValueString()` - the __cookie:__ string for this cookie | ||
* `Cookie parse(cookiestr, request_domain, request_path)` - parses the string onto this cookie or a new one if called directly | ||
* `Boolean matches(access_info)` - returns true if the access_info allows retrieval of this cookie | ||
* `Boolean collidesWith(cookie)` - returns true if the cookies cannot exist in the same space (domain and path match) | ||
@@ -53,9 +56,9 @@ | ||
class to hold numerous cookies from multiple domains correctly | ||
class to hold numerous cookies from multiple domains correctly | ||
##### Methods | ||
* Cookie setCookie(cookie, request_domain, request_path) - modify (or add if not already-existing) a cookie to the jar | ||
* Cookie[] setCookies(cookiestr_or_list, request_domain, request_path) - modify (or add if not already-existing) a large number of cookies to the jar | ||
* Cookie getCookie(cookie_name,access_info) - get a cookie with the name and access_info matching | ||
* Cookie[] getCookies(access_info) - grab all cookies matching this access_info | ||
* `Cookie setCookie(cookie, request_domain, request_path)` - modify (or add if not already-existing) a cookie to the jar | ||
* `Cookie[] setCookies(cookiestr_or_list, request_domain, request_path)` - modify (or add if not already-existing) a large number of cookies to the jar | ||
* `Cookie getCookie(cookie_name,access_info)` - get a cookie with the name and access_info matching | ||
* `Cookie[] getCookies(access_info)` - grab all cookies matching this access_info |
14368
258
61