Custom tls.connect options for https.Agent
npm install agent-optionsAs stated in the documentation for https.request:
> The following additional options from tls.connect() are also accepted when using a custom Agent: ca, cert, ciphers, clientCertEngine, key, passphrase, pfx, rejectUnauthorized, secureProtocol, servername.
This module allows to modify other options, as well as to disable them. For example, SNI can be disabled by setting servername to null (or undefined).
``console`
$ npm i agent-options
* makeAgent(agentOptions) returns https.Agent created with given agentOptions and ensures that those agentOptions are used for tls.connect as well (in a sense of Object.assign).makeAgent(agentOptions, connectOptions)
* uses agentOptions for https.Agent (as is) and connectOptions for tls.connect (again, with Object.assign).
Performing https.request without SNI:
`js
const https = require('https')
const makeAgent = require('agent-options')
const options = {
host: 'example.com',
port: 443,
path: '/',
agent: makeAgent({ servername: null })
}
const req = https.request(options, res => {
res.on('data', data => {
// ...
})
res.on('end', () => {
// ...
})
})
req.on('error', err => {
// ...
})
req.end()
`
Same using got:
`js
const got = require('got')
const makeAgent = require('agent-options')
got('example.com', { agent: makeAgent({ servername: null }) }).then(res => {
// ...
}).catch(err => {
// ...
})
`
* Support agents other than https.Agent`?