Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Created March 3, 2014 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjfontaine/9330165 to your computer and use it in GitHub Desktop.
Save tjfontaine/9330165 to your computer and use it in GitHub Desktop.
diff --git a/lib/_http_server.js b/lib/_http_server.js
index eab7d64..8b2d2b3 100644
--- a/lib/_http_server.js
+++ b/lib/_http_server.js
@@ -349,6 +349,14 @@ function connectionListener(socket) {
// TODO(isaacs): Move all these functions out of here
function socketOnError(e) {
self.emit('clientError', e, this);
+
+ if (e.syscall === 'write' && this._httpMessage) {
+ debug('emitting error on response', e);
+ this._httpMessage.emit('error', e);
+ } else if (e.syscall === 'read' && this.parser && this.parser.incoming) {
+ debug('emitting error on request', e);
+ this.parser.incoming.emit('error', e);
+ }
}
function socketOnData(d) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment