|
|
|
@ -29,10 +29,16 @@ function createHttpsAgent (timeoutConfig, verifySsl) {
|
|
|
|
|
if (!httpsAgentCache[key]) { |
|
|
|
|
verifySsl = !!verifySsl |
|
|
|
|
|
|
|
|
|
// 证书回调函数
|
|
|
|
|
const checkServerIdentity = (host, cert) => { |
|
|
|
|
log.info(`checkServerIdentity: ${host}, CN: ${cert.subject.CN}, C: ${cert.subject.C || cert.issuer.C}, ST: ${cert.subject.ST || cert.issuer.ST}, bits: ${cert.bits}`) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const agent = new HttpsAgent({ |
|
|
|
|
keepAlive: true, |
|
|
|
|
timeout: timeoutConfig.timeout, |
|
|
|
|
keepAliveTimeout: timeoutConfig.keepAliveTimeout, |
|
|
|
|
checkServerIdentity, |
|
|
|
|
rejectUnauthorized: verifySsl |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -40,6 +46,7 @@ function createHttpsAgent (timeoutConfig, verifySsl) {
|
|
|
|
|
keepAlive: true, |
|
|
|
|
timeout: timeoutConfig.timeout, |
|
|
|
|
keepAliveTimeout: timeoutConfig.keepAliveTimeout, |
|
|
|
|
checkServerIdentity, |
|
|
|
|
rejectUnauthorized: false |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|