Skip to content

Commit

Permalink
Fix support for Node v12
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina authored and KhafraDev committed Jun 23, 2022
1 parent d722f4e commit 2fb1c29
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/proxy-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ class ProxyAgent extends DispatcherBase {
callback(null, socket)
return
}
this[kConnectEndpoint]({ ...opts, servername: this[kRequestTls]?.servername || opts.servername, httpSocket: socket }, callback)
let servername
if (this[kRequestTls]) {
servername = this[kRequestTls].servername
} else {
servername = opts.servername
}
this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback)
} catch (err) {
callback(err)
}
Expand Down

0 comments on commit 2fb1c29

Please sign in to comment.