refactor: 1

pull/192/head
xiaojunnuo 2021-09-11 23:49:42 +08:00
parent e5e028a0da
commit e42cfe2f3c
3 changed files with 8 additions and 5 deletions

View File

@ -16,6 +16,9 @@
<a-checkbox v-model="config.app.remoteConfig.enabled" @change="onRemoteConfigEnabledChange">
启用远程配置
</a-checkbox>
<div>
为提升用户体验
</div>
</a-form-item>
<a-form-item label="远程配置地址" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-input v-model="config.app.remoteConfig.url"></a-input>

View File

@ -63,6 +63,7 @@ module.exports = {
if (interceptOpt.sni != null) {
rOptions.servername = interceptOpt.sni
rOptions.agent.options.rejectUnauthorized = false
}
return true
},

View File

@ -16,6 +16,10 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
let proxyReq
const rOptions = commonUtil.getOptionsFormRequest(req, ssl, externalProxy)
if (setting && setting.NODE_TLS_REJECT_UNAUTHORIZED) {
rOptions.agent.options.rejectUnauthorized = true
}
if (rOptions.headers.connection === 'close') {
req.socket.setKeepAlive(false)
} else if (rOptions.customSocketId != null) { // for NTLM
@ -128,11 +132,6 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
}
}
// log.info('开始请求:', process.env.NODE_TLS_REJECT_UNAUTHORIZED, rOptions.rejectUnauthorized, rOptions.agent)
if (setting && setting.NODE_TLS_REJECT_UNAUTHORIZED) {
rOptions.agent.options.rejectUnauthorized = true
}
proxyReq = (rOptions.protocol === 'https:' ? https : http).request(rOptions, (proxyRes) => {
const end = new Date().getTime()
const cost = end - start