summaryrefslogtreecommitdiff
path: root/lib/_http_incoming.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-04-22 08:52:42 -0700
committerisaacs <i@izs.me>2013-04-22 10:38:14 -0700
commit025f9133bbdae6ecd8acfc623b42dfbd6d15d6f9 (patch)
treefd55734ea07860b0ee3d975cad5e95fa8179ddd0 /lib/_http_incoming.js
parent41b75ca9263f368db790fbdcc3963bb1a8c5cb7e (diff)
downloadandroid-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_incoming.js')
-rw-r--r--lib/_http_incoming.js3
1 files changed, 2 insertions, 1 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);
};