diff --git a/lib/http/request.js b/lib/http/request.js index b1fb065d..c14c0f8e 100644 --- a/lib/http/request.js +++ b/lib/http/request.js @@ -308,12 +308,14 @@ Request.prototype.cleanup = function cleanup() { if (this.request) { this.request.removeListener('response', this.onResponse); this.request.removeListener('error', this.onEnd); + this.request.addListener('error', nop); } if (this.response) { this.response.removeListener('data', this.onData); this.response.removeListener('error', this.onEnd); this.response.removeListener('end', this.onEnd); + this.response.addListener('error', nop); } }; @@ -621,6 +623,8 @@ function ensureRequires(ssl) { StringDecoder = require('string_decoder').StringDecoder; } +function nop() {} + /* * Expose */