Skip to content

Commit

Permalink
session: fix response hang when no session to write
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jan 7, 2014
1 parent 5c5e81f commit 2227816
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/middleware/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ function session(options){
// set-cookie
var writeHead = res.writeHead;
res.writeHead = function(){
if (!req.session) return;
if (!req.session) {
debug('no session');
writeHead.apply(res, arguments);
return;
}

var cookie = req.session.cookie
, proto = (req.headers['x-forwarded-proto'] || '').split(',')[0].toLowerCase().trim()
, tls = req.connection.encrypted || (trustProxy && 'https' == proto)
Expand Down

0 comments on commit 2227816

Please sign in to comment.