|
|
@ -1158,18 +1158,21 @@ ClientRequest.prototype.onSocket = function(socket) { |
|
|
|
// Setup "drain" propogation.
|
|
|
|
httpSocketSetup(socket); |
|
|
|
|
|
|
|
var errorListener = function(err) { |
|
|
|
function errorListener(err) { |
|
|
|
debug('HTTP SOCKET ERROR: ' + err.message + '\n' + err.stack); |
|
|
|
if (req) { |
|
|
|
req.emit('error', err); |
|
|
|
// For Safety. Some additional errors might fire later on
|
|
|
|
// and we need to make sure we don't double-fire the error event.
|
|
|
|
req._hadError = true; |
|
|
|
} |
|
|
|
if (parser) { |
|
|
|
parser.finish(); |
|
|
|
freeParser(parser, req); |
|
|
|
} |
|
|
|
socket.destroy(); |
|
|
|
} |
|
|
|
|
|
|
|
socket.on('error', errorListener); |
|
|
|
|
|
|
|
socket.ondata = function(d, start, end) { |
|
|
|