express-session
Advanced tools
Comparing version 1.7.3 to 1.7.4
@@ -0,1 +1,6 @@ | ||
1.7.4 / 2014-08-05 | ||
================== | ||
* Fix response end delay for non-chunked responses | ||
1.7.3 / 2014-08-05 | ||
@@ -2,0 +7,0 @@ ================== |
72
index.js
@@ -190,2 +190,4 @@ /*! | ||
ended = true; | ||
var ret; | ||
@@ -198,4 +200,40 @@ var sync = true; | ||
ended = true; | ||
function writeend() { | ||
if (sync) { | ||
ret = _end.call(res, chunk, encoding); | ||
sync = false; | ||
return; | ||
} | ||
_end.call(res); | ||
} | ||
function writetop() { | ||
if (!sync) { | ||
return ret; | ||
} | ||
var contentLength = Number(res.getHeader('Content-Length')); | ||
if (!isNaN(contentLength) && contentLength > 0) { | ||
// measure chunk | ||
chunk = !Buffer.isBuffer(chunk) | ||
? new Buffer(chunk, encoding) | ||
: chunk; | ||
encoding = undefined; | ||
if (chunk.length !== 0) { | ||
debug('split response'); | ||
ret = _write.call(res, chunk.slice(0, chunk.length - 1)); | ||
chunk = chunk.slice(chunk.length - 1, chunk.length); | ||
return ret; | ||
} | ||
} | ||
ret = _write.call(res, chunk, encoding); | ||
sync = false; | ||
return ret; | ||
} | ||
if (shouldDestroy(req)) { | ||
@@ -210,18 +248,6 @@ // destroy session | ||
debug('destroyed'); | ||
if (sync) { | ||
ret = _end.call(res, chunk, encoding); | ||
sync = false; | ||
return; | ||
} | ||
_end.call(res); | ||
writeend(); | ||
}); | ||
if (sync) { | ||
ret = _write.call(res, chunk, encoding); | ||
sync = false; | ||
} | ||
return ret; | ||
return writetop(); | ||
} | ||
@@ -245,18 +271,6 @@ | ||
debug('saved'); | ||
if (sync) { | ||
ret = _end.call(res, chunk, encoding); | ||
sync = false; | ||
return; | ||
} | ||
_end.call(res); | ||
writeend(); | ||
}); | ||
if (sync) { | ||
ret = _write.call(res, chunk, encoding); | ||
sync = false; | ||
} | ||
return ret; | ||
return writetop(); | ||
} | ||
@@ -263,0 +277,0 @@ |
{ | ||
"name": "express-session", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Simple session middleware for Express", | ||
@@ -5,0 +5,0 @@ "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33323
794