From 89a22bc00396f069eeb054ce30891a204077d16d Mon Sep 17 00:00:00 2001 From: Jarrett Cruger Date: Wed, 26 Mar 2014 22:07:09 -0400 Subject: [PATCH] [fix] set connection to CLOSE in cases where the agent is false. --- lib/http-proxy/common.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 1c838c9..51df138 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -45,6 +45,15 @@ common.setupOutgoing = function(outgoing, options, req, forward) { outgoing.agent = options.agent || false; + // + // Remark: If we are false set the connection: close. This is the right thing to do + // as node core doesn't handle this COMPLETELY properly yet. + // + if(!outgoing.agent) { + outgoing.headers = outgoing.headers || {}; + outgoing.headers.connection = 'close'; + } + // // Remark: Can we somehow not use url.parse as a perf optimization? //