Skip to content

Commit

Permalink
bugfix: 当某个域名未配置拦截配置,但启动了彩蛋功能时,彩蛋功能失效的问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Oct 17, 2024
1 parent f2f0169 commit 7584fed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/mitmproxy/src/lib/proxy/middleware/overwall.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ function matched (hostname, overWallTargetMap) {
return 'overwall config'
}
if (pacClient == null) {
return false
return null
}
const ret = pacClient.FindProxyForURL('https://' + hostname, hostname)
if (ret && ret.indexOf('PROXY ') === 0) {
log.info(`matchHostname: matched overwall: '${hostname}' -> '${ret}' in pac.txt`)
return 'overwall pac'
} else {
log.debug(`matchHostname: matched overwall: Not-Matched '${hostname}' -> '${ret}' in pac.txt`)
return false
return null
}
}

Expand Down Expand Up @@ -148,7 +148,11 @@ function createOverwallMiddleware (overWallConfig) {
return {
sslConnectInterceptor: (req, cltSocket, head) => {
const hostname = req.url.split(':')[0]
return matched(hostname, overWallTargetMap)
const ret = matched(hostname, overWallTargetMap)
if (ret == null) {
return null // 返回 null,由下一个拦截器校验
}
return true // 拦截
},
requestIntercept (context, req, res, ssl, next) {
const { rOptions, log, RequestCounter } = context
Expand All @@ -157,7 +161,7 @@ function createOverwallMiddleware (overWallConfig) {
}
const hostname = rOptions.hostname
const matchedResult = matched(hostname, overWallTargetMap)
if (!matchedResult) {
if (matchedResult == null) {
return
}
const cacheKey = '__over_wall_proxy__'
Expand Down

0 comments on commit 7584fed

Please sign in to comment.