@@ -374,9 +374,7 @@ function socketCloseListener() {
374374 // receive a response. The error needs to
375375 // fire on the request.
376376 req . socket . _hadError = true ;
377- if ( ! req . aborted ) {
378- req . emit ( 'error' , connResetException ( 'socket hang up' ) ) ;
379- }
377+ req . emit ( 'error' , connResetException ( 'socket hang up' ) ) ;
380378 }
381379 req . emit ( 'close' ) ;
382380 }
@@ -402,9 +400,7 @@ function socketErrorListener(err) {
402400 // For Safety. Some additional errors might fire later on
403401 // and we need to make sure we don't double-fire the error event.
404402 req . socket . _hadError = true ;
405- if ( ! req . aborted ) {
406- req . emit ( 'error' , err ) ;
407- }
403+ req . emit ( 'error' , err ) ;
408404 }
409405
410406 // Handle any pending data
@@ -438,9 +434,7 @@ function socketOnEnd() {
438434 // If we don't have a response then we know that the socket
439435 // ended prematurely and we need to emit an error on the request.
440436 req . socket . _hadError = true ;
441- if ( ! req . aborted ) {
442- req . emit ( 'error' , connResetException ( 'socket hang up' ) ) ;
443- }
437+ req . emit ( 'error' , connResetException ( 'socket hang up' ) ) ;
444438 }
445439 if ( parser ) {
446440 parser . finish ( ) ;
@@ -463,9 +457,7 @@ function socketOnData(d) {
463457 freeParser ( parser , req , socket ) ;
464458 socket . destroy ( ) ;
465459 req . socket . _hadError = true ;
466- if ( ! req . aborted ) {
467- req . emit ( 'error' , ret ) ;
468- }
460+ req . emit ( 'error' , ret ) ;
469461 } else if ( parser . incoming && parser . incoming . upgrade ) {
470462 // Upgrade (if status code 101) or CONNECT
471463 var bytesParsed = ret ;
0 commit comments