diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_http_incoming.js | 3 | ||||
-rw-r--r-- | lib/_http_outgoing.js | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index fd2f83ef3a..53a3a386fa 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -103,7 +103,8 @@ IncomingMessage.prototype._read = function(n) { IncomingMessage.prototype.destroy = function(error) { - this.socket.destroy(error); + if (this.socket) + this.socket.destroy(error); }; diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 9a9b52b92e..055f6491b3 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -94,7 +94,12 @@ OutgoingMessage.prototype.setTimeout = function(msecs, callback) { OutgoingMessage.prototype.destroy = function(error) { - this.socket.destroy(error); + if (this.socket) + this.socket.destroy(error); + else + this.once('socket', function(socket) { + socket.destroy(error); + }); }; |