http: Don't try to destroy nonexistent sockets
authorisaacs <i@izs.me>
Mon, 22 Apr 2013 15:52:42 +0000 (08:52 -0700)
committerisaacs <i@izs.me>
Mon, 22 Apr 2013 16:54:04 +0000 (09:54 -0700)
commit01e29202193cfc4257d6c638b8c08b7fcc2c9931
tree4e626d7f79d3745ba877738052c70fbebfafa962
parent1d794ec43e5a5b72ab4aeafa91d2e54fd92503b8
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.
lib/http.js
test/simple/test-http-incoming-pipelined-socket-destroy.js [new file with mode: 0644]