Permalink
Browse files

don't send file in HEAD requests

in current nodes, doing so will raise an exception at which point the
file will never be closed. This leads to file handle starvation sooner
or later
  • Loading branch information...
1 parent 6587d29 commit 8c37d6fa32ca10e4198490af8a25595bdb5abf16 @pilif committed with felixge Jun 30, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/paperboy.js
View
@@ -47,7 +47,7 @@ exports.streamFile = function (filepath, headerFields, stat, res, req, emitter)
res.writeHead(statCode, headerFields);
//If we sent a 304, skip sending a body
- if (statCode == 304) {
+ if (statCode == 304 || req.method === 'HEAD') {
res.end();
emitter.emit("success", statCode);
}

0 comments on commit 8c37d6f

Please sign in to comment.