Null references to request object on socket errors.

Regarding #3199 and #3179 and issues seen in production.
Hopefully this fixes them.
pull/24503/head
isaacs 2012-05-01 14:26:18 -07:00
parent acf19500ee
commit bfe9cdb7f2
1 changed files with 7 additions and 0 deletions

View File

@ -1209,6 +1209,13 @@ ClientRequest.prototype.onSocket = function(socket) {
// fire on the request.
req.emit('error', createHangUpError());
}
// Nothing more to be done with this req, since the socket
// is closed, and we've emitted the appropriate abort/end/close/error
// events. Disavow all knowledge, and break the references to
// the variables trapped by closures and on the socket object.
req = null;
socket._httpMessage = null;
}
socket.on('close', closeListener);