Permalink
Browse files

Let session cookie live beyond closing of the browser.

Also set session cookie path to "/".
  • Loading branch information...
1 parent 8865efc commit f213d9b61e874d6c6130b456fe62061d7f1ddfff @dmcquay dmcquay committed Oct 10, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/cookie-sessions.js
View
@@ -28,8 +28,10 @@ var exports = module.exports = function(settings){
// response so that the timestamp is up to date, and the session
// does not expire unless the user is inactive.
- var cookiestr = escape(s.session_key) + '=' +
- escape(exports.serialize(s.secret, req.session));
+ var cookiestr = escape(s.session_key) + '='
+ + escape(exports.serialize(s.secret, req.session))
+ + '; expires=' + (new Date(new Date().getTime() + (s.timeout))).toUTCString()
+ + '; path=/';
if(Array.isArray(headers)) headers.push(['Set-Cookie', cookiestr]);
else {

0 comments on commit f213d9b

Please sign in to comment.