http: Only send connection:keep-alive if necessary
authorisaacs <i@izs.me>
Sun, 18 Aug 2013 01:50:59 +0000 (18:50 -0700)
committerisaacs <i@izs.me>
Wed, 4 Sep 2013 18:19:39 +0000 (11:19 -0700)
commit15a5a4a9453a056b783c7ff0966e31c3c6b7d7e1
tree4c66bc29fb29aeaaf796473f8ede7ce7789f68b5
parent689e5c9d3db67ccfb81a1caefb04176c41a17744
http: Only send connection:keep-alive if necessary

In cases where the Agent has maxSockets=Infinity, and
keepAlive=false, there's no case where we won't immediately close the
connection after the response is completed.

Since we're going to close it anyway, send a `connection:close` header
rather than a `connection:keep-alive` header.  Still send the
`connection:keep-alive` if the agent will actually reuse the socket,
however.

Closes #5838
lib/_http_client.js
test/simple/test-http-raw-headers.js
test/simple/test-http-should-keep-alive.js