Skip to content

Commit

Permalink
only close socket if it exists, fix #89
Browse files Browse the repository at this point in the history
  • Loading branch information
rlidwka committed Jul 21, 2014
1 parent ff8a5e9 commit 41d4997
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ module.exports.log_and_etagify = function(req, res, next) {
// as an error handler, we can't report error properly,
// and should just close socket
if (err.message.match(/set headers after they are sent/)) {
return res.socket.destroy()
if (res.socket != null) res.socket.destroy()
return
} else {
throw err
}
Expand Down

0 comments on commit 41d4997

Please sign in to comment.