diff options
author | isaacs <i@izs.me> | 2013-04-22 08:52:42 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-04-22 10:38:14 -0700 |
commit | 025f9133bbdae6ecd8acfc623b42dfbd6d15d6f9 (patch) | |
tree | fd55734ea07860b0ee3d975cad5e95fa8179ddd0 /lib/_http_outgoing.js | |
parent | 41b75ca9263f368db790fbdcc3963bb1a8c5cb7e (diff) | |
download | android-node-v8-025f9133bbdae6ecd8acfc623b42dfbd6d15d6f9.tar.gz android-node-v8-025f9133bbdae6ecd8acfc623b42dfbd6d15d6f9.tar.bz2 android-node-v8-025f9133bbdae6ecd8acfc623b42dfbd6d15d6f9.zip |
http: Don't try to destroy nonexistent sockets
Fixes #3740
In the case of pipelined requests, you can have a situation where
the socket gets destroyed via one req/res object, but then trying
to destroy *another* req/res on the same socket will cause it to
call undefined.destroy(), since it was already removed from that
message.
Add a guard to OutgoingMessage.destroy and IncomingMessage.destroy
to prevent this error.
Diffstat (limited to 'lib/_http_outgoing.js')
-rw-r--r-- | lib/_http_outgoing.js | 7 |
1 files changed, 6 insertions, 1 deletions
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); + }); }; |