Skip to content

Commit

Permalink
only set ALPNProtocols when the property does not already exist
Browse files Browse the repository at this point in the history
I guess maybe you could do `ALPNProtocols: null` to opt-out
of this new behavior. Not sure if it's really necessary but hey.
  • Loading branch information
TooTallNate committed Jun 27, 2017
1 parent 04cb725 commit ed300a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ function HttpsProxyAgent(opts) {
proxy.host = proxy.hostname || proxy.host;
proxy.port = +proxy.port || (this.secureProxy ? 443 : 80);

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

if (proxy.host && proxy.path) {
Expand Down

0 comments on commit ed300a4

Please sign in to comment.