Skip to content

Commit

Permalink
Merge 8629744 into df346d8
Browse files Browse the repository at this point in the history
  • Loading branch information
antamb committed Jan 23, 2019
2 parents df346d8 + 8629744 commit 44aee15
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function constructProxyHeaderWhiteList (headers, proxyHeaderWhiteList) {
function constructTunnelOptions (request, proxyHeaders) {
var proxy = request.proxy

var agentOptions = request.agentOptions || {}

var tunnelOptions = {
proxy: {
host: proxy.hostname,
Expand All @@ -75,11 +77,11 @@ function constructTunnelOptions (request, proxyHeaders) {
headers: proxyHeaders
},
headers: request.headers,
ca: request.ca,
cert: request.cert,
key: request.key,
passphrase: request.passphrase,
pfx: request.pfx,
ca: request.ca || agentOptions.ca,
cert: request.cert || agentOptions.cert,
key: request.key || agentOptions.key,
passphrase: request.passphrase || agentOptions.passphrase,
pfx: request.pfx || agentOptions.pfx,
ciphers: request.ciphers,
rejectUnauthorized: request.rejectUnauthorized,
secureOptions: request.secureOptions,
Expand Down
14 changes: 14 additions & 0 deletions tests/test-tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,20 @@ function addTests () {
'https response',
'200 https ok'
])

runTest('mutual https over http using agentOptions, tunnel=default', {
url: ss2.url,
proxy: s.url,
agentOptions: {
cert: clientCert,
key: clientKey,
passphrase: clientPassword
}
}, [
'http connect to localhost:' + ss2.port,
'https response',
'200 https ok'
])
}

tape('setup', function (t) {
Expand Down

0 comments on commit 44aee15

Please sign in to comment.