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