Skip to content

Commit ed300a4

Browse files
committed
only set ALPNProtocols when the property does not already exist
I guess maybe you could do `ALPNProtocols: null` to opt-out of this new behavior. Not sure if it's really necessary but hey.
1 parent 04cb725 commit ed300a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ function HttpsProxyAgent(opts) {
4141
proxy.host = proxy.hostname || proxy.host;
4242
proxy.port = +proxy.port || (this.secureProxy ? 443 : 80);
4343

44-
if (this.secureProxy) {
45-
proxy.ALPNProtocols = proxy.ALPNProtocols || ['http 1.1']
44+
// ALPN is supported by Node.js >= v5.
45+
// attempt to negotiate http/1.1 for proxy servers that support http/2
46+
if (this.secureProxy && !('ALPNProtocols' in proxy)) {
47+
proxy.ALPNProtocols = ['http 1.1']
4648
}
4749

4850
if (proxy.host && proxy.path) {

0 commit comments

Comments
 (0)