Skip to content

Commit 89a22bc

Browse files
committed
[fix] set connection to CLOSE in cases where the agent is false.
1 parent a7b16eb commit 89a22bc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/http-proxy/common.js

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
4545

4646
outgoing.agent = options.agent || false;
4747

48+
//
49+
// Remark: If we are false set the connection: close. This is the right thing to do
50+
// as node core doesn't handle this COMPLETELY properly yet.
51+
//
52+
if(!outgoing.agent) {
53+
outgoing.headers = outgoing.headers || {};
54+
outgoing.headers.connection = 'close';
55+
}
56+
4857
//
4958
// Remark: Can we somehow not use url.parse as a perf optimization?
5059
//

0 commit comments

Comments
 (0)