[Pkg-javascript-commits] [node-cookies] 01/02: Imported Upstream version 0.4.1

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Mon Jun 30 14:16:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to branch master
in repository node-cookies.

commit b78cda8f678d326b9cab1bd66221911f65c13ac4
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Mon Jun 30 14:08:28 2014 +0000

    Imported Upstream version 0.4.1
---
 .gitignore      |   1 +
 .travis.yml     |   4 ++
 History.md      |   5 ++
 LICENSE.txt     |  22 +++++++++
 README.md       | 120 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/cookies.js  | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 package.json    |  32 +++++++++++++
 test/express.js |  80 +++++++++++++++++++++++++++++++
 test/http.js    |  79 +++++++++++++++++++++++++++++++
 test/restify.js |  69 +++++++++++++++++++++++++++
 10 files changed, 555 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..61fec9a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+  - 0.10
+  - 0.8
diff --git a/History.md b/History.md
new file mode 100644
index 0000000..4663729
--- /dev/null
+++ b/History.md
@@ -0,0 +1,5 @@
+
+0.4.0 / 2014-01-31
+==================
+
+ * added: allow passing an array of strings as keys
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..0b7cd4e
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2014 Jed Schmidt, http://jed.is/
+ 
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+ 
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+ 
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..32311f7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,120 @@
+Cookies
+=======
+
+[![Build Status](https://secure.travis-ci.org/expressjs/cookies.png)](http://travis-ci.org/expressjs/cookies)
+
+Cookies is a [node.js](http://nodejs.org/) module for getting and setting HTTP(S) cookies. Cookies can be signed to prevent tampering, using [Keygrip](https://github.com/expressjs/keygrip). It can be used with the built-in node.js HTTP library, or as Connect/Express middleware.
+
+## Requirements
+
+* [node.js](http://nodejs.org/), tested with 0.8 and 0.10
+
+## Install
+
+    $ npm install cookies
+
+## Features
+
+* **Lazy**: Since cookie verification against multiple keys could be expensive, cookies are only verified lazily when accessed, not eagerly on each request.
+
+* **Secure**: All cookies are `httponly` by default, and cookies sent over SSL are `secure` by default. An error will be thrown if you try to send secure cookies over an insecure socket.
+
+* **Unobtrusive**: Signed cookies are stored the same way as unsigned cookies, instead of in an obfuscated signing format. An additional signature cookie is stored for each signed cookie, using a standard naming convention (_cookie-name_`.sig`). This allows other libraries to access the original cookies without having to know the signing mechanism.
+
+* **Agnostic**: This library is optimized for use with [Keygrip](https://github.com/expressjs/keygrip), but does not require it; you can implement your own signing scheme instead if you like and use this library only to read/write cookies. Factoring the signing into a separate library encourages code reuse and allows you to use the same signing library for other areas where signing is needed, such as in URLs.
+
+## API
+
+### cookies = new Cookies( request, response, keys )
+
+This creates a cookie jar corresponding to the current _request_ and _response_. A [Keygrip](https://github.com/expressjs/keygrip) object or an array of keys can optionally be passed as the third argument _keygrip_ to enable cryptographic signing based on SHA1 HMAC, using rotated credentials.
+
+Note that since this only saves parameters without any other processing, it is very lightweight. Cookies are only parsed on demand when they are accessed.
+
+### express.createServer( Cookies.express( keys ) )
+
+This adds cookie support as a Connect middleware layer for use in Express apps, allowing inbound cookies to be read using `req.cookies.get` and outbound cookies to be set using `res.cookies.set`.
+
+### cookies.get( name, [ options ] )
+
+This extracts the cookie with the given name from the `Cookie` header in the request. If such a cookie exists, its value is returned. Otherwise, nothing is returned.
+
+`{ signed: true }` can optionally be passed as the second parameter _options_. In this case, a signature cookie (a cookie of same name ending with the `.sig` suffix appended) is fetched. If no such cookie exists, nothing is returned.
+
+If the signature cookie _does_ exist, the provided [Keygrip](https://github.com/expressjs/keygrip) object is used to check whether the hash of _cookie-name_=_cookie-value_ matches that of any registered key:
+
+* If the signature cookie hash matches the first key, the original cookie value is returned.
+* If the signature cookie hash matches any other key, the original cookie value is returned AND an outbound header is set to update the signature cookie's value to the hash of the first key. This enables automatic freshening of signature cookies that have become stale due to key rotation.
+* If the signature cookie hash does not match any key, nothing is returned, and an outbound header with an expired date is used to delete the cookie.
+
+### cookies.set( name, [ value ], [ options ] )
+
+This sets the given cookie in the response and returns the current context to allow chaining.
+
+If the _value_ is omitted, an outbound header with an expired date is used to delete the cookie.
+
+If the _options_ object is provided, it will be used to generate the outbound cookie header as follows:
+
+* `maxage`: a number representing the milliseconds from `Date.now()` for expiry
+* `expires`: a `Date` object indicating the cookie's expiration date (expires at the end of session by default).
+* `path`: a string indicating the path of the cookie (`/` by default).
+* `domain`: a string indicating the domain of the cookie (no default).
+* `secure`: a boolean indicating whether the cookie is only to be sent over HTTPS (`false` by default for HTTP, `true` by default for HTTPS).
+* `secureProxy`: a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process).
+* `httpOnly`: a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (`true` by default).
+* `signed`: a boolean indicating whether the cookie is to be signed (`false` by default). If this is true, another cookie of the same name with the `.sig` suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of _cookie-name_=_cookie-value_ against the first [Keygrip](https://github.com/expressjs/keygrip) key. This signature key is used to detect tampering the next time a cookie is received.
+* `overwrite`: a boolean indicating whether to overwrite previously set cookies of the same name (`false` by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.
+
+## Example
+
+```javascript
+var http    = require( "http" )
+var Cookies = require( "cookies" )
+
+server = http.createServer( function( req, res ) {
+  var cookies = new Cookies( req, res, keys )
+    , unsigned, signed, tampered
+
+  if ( req.url == "/set" ) {
+    cookies
+      // set a regular cookie
+      .set( "unsigned", "foo", { httpOnly: false } )
+
+      // set a signed cookie
+      .set( "signed", "bar", { signed: true } )
+
+      // mimic a signed cookie, but with a bogus signature
+      .set( "tampered", "baz" )
+      .set( "tampered.sig", "bogus" )
+
+    res.writeHead( 302, { "Location": "/" } )
+    return res.end( "Now let's check." )
+  }
+
+  unsigned = cookies.get( "unsigned" )
+  signed = cookies.get( "signed", { signed: true } )
+  tampered = cookies.get( "tampered", { signed: true } )
+
+  assert.equal( unsigned, "foo" )
+  assert.equal( signed, "bar" )
+  assert.notEqual( tampered, "baz" )
+  assert.equal( tampered, undefined )
+
+  res.writeHead( 200, { "Content-Type": "text/plain" } )
+  res.end(
+    "unsigned expected: foo\n\n" +
+    "unsigned actual: " + unsigned + "\n\n" +
+    "signed expected: bar\n\n" +
+    "signed actual: " + signed + "\n\n" +
+    "tampered expected: undefined\n\n"+
+    "tampered: " + tampered + "\n\n"
+  )
+})
+```
+
+Copyright
+---------
+
+Copyright (c) 2014 Jed Schmidt. See LICENSE.txt for details.
+
+Send any questions or comments [here](http://twitter.com/jedschmidt).
diff --git a/lib/cookies.js b/lib/cookies.js
new file mode 100644
index 0000000..c1b615b
--- /dev/null
+++ b/lib/cookies.js
@@ -0,0 +1,143 @@
+var Keygrip = require('keygrip')
+var http = require('http')
+var cache = {}
+
+function Cookies(request, response, keys) {
+  if (!(this instanceof Cookies)) return new Cookies(request, response, keys)
+
+  this.request = request
+  this.response = response
+  if (keys) {
+    // array of key strings
+    if (Array.isArray(keys))
+      this.keys = new Keygrip(keys)
+    // any keygrip constructor to allow different versions
+    else if (keys.constructor && keys.constructor.name === 'Keygrip')
+      this.keys = keys
+  }
+}
+
+Cookies.prototype = {
+  get: function(name, opts) {
+    var sigName = name + ".sig"
+      , header, match, value, remote, data, index
+      , signed = opts && opts.signed !== undefined ? opts.signed : !!this.keys
+
+    header = this.request.headers["cookie"]
+    if (!header) return
+
+    match = header.match(getPattern(name))
+    if (!match) return
+
+    value = match[1]
+    if (!opts || !signed) return value
+
+    remote = this.get(sigName)
+    if (!remote) return
+
+    data = name + "=" + value
+    if (!this.keys) throw new Error('.keys required for signed cookies');
+    index = this.keys.index(data, remote)
+
+    if (index < 0) {
+      this.set(sigName, null, {path: "/", signed: false })
+    } else {
+      index && this.set(sigName, this.keys.sign(data), { signed: false })
+      return value
+    }
+  },
+
+  set: function(name, value, opts) {
+    var res = this.response
+      , req = this.request
+      , headers = res.getHeader("Set-Cookie") || []
+      , secure = req.connection.encrypted
+      , cookie = new Cookie(name, value, opts)
+      , signed = opts && opts.signed !== undefined ? opts.signed : !!this.keys
+
+    if (typeof headers == "string") headers = [headers]
+
+    if (!secure && opts && opts.secure) throw new Error("Cannot send secure cookie over unencrypted socket")
+
+    cookie.secure = secure
+    if (opts && "secure" in opts) cookie.secure = opts.secure
+    if (opts && "secureProxy" in opts) cookie.secure = opts.secureProxy
+    headers = pushCookie(headers, cookie)
+
+    if (opts && signed) {
+      if (!this.keys) throw new Error('.keys required for signed cookies');
+      cookie.value = this.keys.sign(cookie.toString())
+      cookie.name += ".sig"
+      headers = pushCookie(headers, cookie)
+    }
+
+    var setHeader = res.set ? http.OutgoingMessage.prototype.setHeader : res.setHeader
+    setHeader.call(res, 'Set-Cookie', headers)
+    return this
+  }
+}
+
+function Cookie(name, value, attrs) {
+  value || (this.expires = new Date(0))
+
+  this.name = name
+  this.value = value || ""
+
+  for (var name in attrs) this[name] = attrs[name]
+}
+
+Cookie.prototype = {
+  path: "/",
+  expires: undefined,
+  domain: undefined,
+  httpOnly: true,
+  secure: false,
+  overwrite: false,
+
+  toString: function() {
+    return this.name + "=" + this.value
+  },
+
+  toHeader: function() {
+    var header = this.toString()
+
+    if (this.maxage) this.expires = new Date(Date.now() + this.maxage);
+
+    if (this.path     ) header += "; path=" + this.path
+    if (this.expires  ) header += "; expires=" + this.expires.toUTCString()
+    if (this.domain   ) header += "; domain=" + this.domain
+    if (this.secure   ) header += "; secure"
+    if (this.httpOnly ) header += "; httponly"
+
+    return header
+  }
+}
+
+function getPattern(name) {
+  if (cache[name]) return cache[name]
+
+  return cache[name] = new RegExp(
+    "(?:^|;) *" +
+    name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") +
+    "=([^;]*)"
+  )
+}
+
+function pushCookie(cookies, cookie) {
+  if (cookie.overwrite) {
+    cookies = cookies.filter(function(c) { return c.indexOf(cookie.name+'=') !== 0 })
+  }
+  cookies.push(cookie.toHeader())
+  return cookies
+}
+
+Cookies.connect = Cookies.express = function(keys) {
+  return function(req, res, next) {
+    req.cookies = res.cookies = new Cookies(req, res, keys)
+    next()
+  }
+}
+
+Cookies.Cookie = Cookie
+
+module.exports = Cookies
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a22113d
--- /dev/null
+++ b/package.json
@@ -0,0 +1,32 @@
+{
+  "name": "cookies",
+  "version": "0.4.1",
+  "description": "Cookies, optionally signed using Keygrip.",
+  "main": "./lib/cookies",
+  "dependencies": {
+    "keygrip": "~1.0.0"
+  },
+  "devDependencies": {
+    "express": "*",
+    "restify": "*"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://raw.github.com/expressjs/cookies/master/LICENSE.txt"
+    }
+  ],
+  "engines": {
+    "node": ">= 0.6.0"
+  },
+  "author": "Jed Schmidt <tr at nslator.jp> (http://jed.is)",
+  "homepage": "https://github.com/expressjs/cookies",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/expressjs/cookies.git"
+  },
+  "scripts": {
+    "test": "node ./test/http.js && node ./test/express.js && node ./test/restify.js"
+  },
+  "optionalDependencies": {}
+}
diff --git a/test/express.js b/test/express.js
new file mode 100644
index 0000000..af00870
--- /dev/null
+++ b/test/express.js
@@ -0,0 +1,80 @@
+#!/usr/bin/env node
+
+var assert = require( "assert" )
+  , express = require( "express" )
+  , http = require( "http" )
+  , keys = require( "keygrip" )(['a', 'b'])
+  , cookies = require( "../" ).express
+  , options = { host: "localhost", port: 8000, path: "/set" }
+  , app = express.createServer()
+
+app.use( cookies( keys ) )
+
+app.get( "/set", function(req, res) {
+  res.cookies
+    // set a regular cookie
+    .set( "unsigned", "foo", { signed:false, httpOnly: false } )
+
+    // set a signed cookie
+    .set( "signed", "bar", { signed: true } )
+
+    // mimic a signed cookie, but with a bogus signature
+    .set( "tampered", "baz" )
+    .set( "tampered.sig", "bogus" )
+
+    // set a cookie that will be overwritten
+    .set( "overwrite", "old-value", { signed: true } )
+    .set( "overwrite", "new-value", { overwrite: true, signed: true } )
+
+  res.writeHead(302, {Location: "/"})
+  res.end()
+})
+
+app.get("/", function(req, res) {
+  var unsigned = req.cookies.get( "unsigned" )
+    , signed = req.cookies.get( "signed", { signed: true } )
+    , tampered = req.cookies.get( "tampered", { signed: true } )
+    , overwrite = req.cookies.get( "overwrite", { signed: true } )
+
+  assert.equal( unsigned, "foo" )
+  assert.equal( req.cookies.get( "unsigned.sig", { signed:false } ), undefined)
+  assert.equal( signed, "bar" )
+  assert.equal( req.cookies.get( "signed.sig", { signed: false } ), keys.sign('signed=bar') )
+  assert.notEqual( tampered, "baz" )
+  assert.equal( tampered, undefined )
+  assert.equal( overwrite, "new-value" )
+  assert.equal( req.cookies.get( "overwrite.sig", { signed:false } ), keys.sign('overwrite=new-value') )
+
+  assert.equal(res.getHeader('Set-Cookie'), 'tampered.sig=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; httponly')
+
+  res.send(
+    "unsigned expected: foo\n" +
+    "unsigned actual: " + unsigned + "\n\n" +
+    "signed expected: bar\n" +
+    "signed actual: " + signed + "\n\n" +
+    "tampered expected: undefined\n"+
+    "tampered: " + tampered + "\n"
+  )
+})
+
+var server = require('http').createServer(app);
+
+server.listen( 8000 )
+
+http.get( options, function( res ) {
+  var header = res.headers[ "set-cookie" ]
+    , body = ""
+
+  console.log( "\ncookies set:", header )
+  console.log( "\n============\n" )
+  assert.equal(header.length, 7)
+
+  options.path = res.headers[ "Location" ]
+  options.headers = { "Cookie": header.join(";") }
+
+  http.get( options, function( res ) {
+    res.on( "data", function( chunk ){ body += chunk } )
+    res.on( "end", function(){ console.log( body ) })
+    server.close()
+  })
+})
diff --git a/test/http.js b/test/http.js
new file mode 100644
index 0000000..5d1f4f3
--- /dev/null
+++ b/test/http.js
@@ -0,0 +1,79 @@
+#!/usr/bin/env node
+
+var assert = require( "assert" )
+  , http = require( "http" )
+  , keys = require( "keygrip" )(['a', 'b'])
+  , Cookies = require( "../" )
+  , options = { host: "localhost", port: 8000, path: "/set" }
+  , server
+
+server = http.createServer( function( req, res ) {
+  var cookies = new Cookies( req, res, keys )
+    , unsigned, signed, tampered, overwrite
+
+  if ( req.url == "/set" ) {
+    cookies
+      // set a regular cookie
+      .set( "unsigned", "foo", { signed:false, httpOnly: false } )
+
+      // set a signed cookie
+      .set( "signed", "bar", { signed: true } )
+
+      // mimic a signed cookie, but with a bogus signature
+      .set( "tampered", "baz" )
+      .set( "tampered.sig", "bogus" )
+
+      // set a cookie that will be overwritten
+      .set( "overwrite", "old-value", { signed: true } )
+      .set( "overwrite", "new-value", { overwrite: true, signed: true } )
+
+    res.writeHead( 302, { "Location": "/" } )
+    return res.end( "Now let's check." )
+  }
+
+  unsigned = cookies.get( "unsigned" )
+  signed = cookies.get( "signed", { signed: true } )
+  tampered = cookies.get( "tampered", { signed: true } )
+  overwrite = cookies.get( "overwrite", { signed: true } )
+
+  assert.equal( unsigned, "foo" )
+  assert.equal( cookies.get( "unsigned.sig", { signed:false } ), undefined)
+  assert.equal( signed, "bar" )
+  assert.equal( cookies.get( "signed.sig", { signed: false } ), keys.sign('signed=bar') )
+  assert.notEqual( tampered, "baz" )
+  assert.equal( tampered, undefined )
+  assert.equal( overwrite, "new-value" )
+  assert.equal( cookies.get( "overwrite.sig", { signed:false } ), keys.sign('overwrite=new-value') )
+
+  assert.equal(res.getHeader('Set-Cookie'), 'tampered.sig=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; httponly')
+
+  res.writeHead( 200, { "Content-Type": "text/plain" } )
+  res.end(
+    "unsigned expected: foo\n" +
+    "unsigned actual: " + unsigned + "\n\n" +
+    "signed expected: bar\n" +
+    "signed actual: " + signed + "\n\n" +
+    "tampered expected: undefined\n"+
+    "tampered: " + tampered + "\n"
+  )
+})
+
+server.listen( 8000 )
+
+http.get( options, function( res ) {
+  var cookies = res.headers[ "set-cookie" ]
+    , body = ""
+
+  console.log( "\ncookies set:", cookies )
+  console.log( "\n============\n" )
+  assert.equal(cookies.length, 7)
+
+  options.path = res.headers[ "location" ]
+  options.headers = { "Cookie": cookies.join(";") }
+
+  http.get( options, function( res ) {
+    res.on( "data", function( chunk ){ body += chunk } )
+    res.on( "end", function(){ console.log( body ) })
+    server.close()
+  })
+})
\ No newline at end of file
diff --git a/test/restify.js b/test/restify.js
new file mode 100644
index 0000000..6d5699e
--- /dev/null
+++ b/test/restify.js
@@ -0,0 +1,69 @@
+var assert = require('assert'),
+    restify = require('restify'),
+    keys = require('keygrip')(['a', 'b']),
+    http = require('http'),
+    Cookies = require('../')
+
+var server = restify.createServer()
+
+server.get('/set', function (req, res) {
+  setCookies(req, res)
+  res.json({ status : 'ok'})
+})
+
+server.get('/get', function (req, res) {
+  assertCookies(req, res)
+  res.send(200)
+})
+
+server.listen(8000, function() {
+  http.get({ path: '/set', host: 'localhost', port: 8000 }, function(res) {
+    assert.equal(res.statusCode, 200)
+    var header = res.headers['set-cookie']
+    assertSetCookieHeader(header)
+    http.get({ path: '/get', host: 'localhost', port: 8000, headers: { 'Cookie': header.join(';') } }, function(res) {
+      assert.equal(res.statusCode, 200)
+      server.close()
+    })
+  })
+})
+
+function setCookies(req, res) {
+  var cookies = new Cookies(req, res, keys)
+  cookies
+    .set('unsigned', 'foo', { signed:false, httpOnly: false })
+    .set('signed', 'bar', { signed: true })
+    .set('tampered', 'baz')
+    .set('tampered.sig', 'bogus')
+    .set('overwrite', 'old-value', { signed: true })
+    .set('overwrite', 'new-value', { overwrite: true, signed: true })
+}
+
+function assertCookies(req, res) {
+  var cookies = new Cookies(req, res, keys)
+  var unsigned = cookies.get('unsigned'),
+    signed = cookies.get('signed', { signed: true }),
+    tampered = cookies.get('tampered', { signed: true }),
+    overwrite = cookies.get('overwrite', { signed: true })
+
+  assert.equal(unsigned, 'foo')
+  assert.equal(cookies.get('unsigned.sig', { signed:false }), undefined)
+  assert.equal(signed, 'bar')
+  assert.equal(cookies.get('signed.sig', { signed: false }), keys.sign('signed=bar'))
+  assert.notEqual(tampered, 'baz')
+  assert.equal(tampered, undefined)
+  assert.equal(overwrite, 'new-value')
+  assert.equal(cookies.get('overwrite.sig', { signed:false }), keys.sign('overwrite=new-value'))
+  assert.equal(res.getHeader('Set-Cookie'), 'tampered.sig=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; httponly')
+}
+
+function assertSetCookieHeader(header) {
+  assert.equal(header.length, 7)
+  assert.equal(header[0], 'unsigned=foo; path=/')
+  assert.equal(header[1], 'signed=bar; path=/; httponly')
+  assert.ok(/^signed\.sig=.{27}; path=\/; httponly$/.test(header[2]))
+  assert.equal(header[3], 'tampered=baz; path=/; httponly')
+  assert.equal(header[4], 'tampered.sig=bogus; path=/; httponly')
+  assert.equal(header[5], 'overwrite=new-value; path=/; httponly')
+  assert.ok(/^overwrite\.sig=.{27}; path=\/; httponly$/.test(header[6]))
+}
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-cookies.git



More information about the Pkg-javascript-commits mailing list