From 7584fed3468af8688e3c6ec6d69f3e9f564df67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Fri, 18 Oct 2024 00:43:04 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E5=BD=93=E6=9F=90=E4=B8=AA=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E6=9C=AA=E9=85=8D=E7=BD=AE=E6=8B=A6=E6=88=AA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E4=BD=86=E5=90=AF=E5=8A=A8=E4=BA=86=E5=BD=A9?= =?UTF-8?q?=E8=9B=8B=E5=8A=9F=E8=83=BD=E6=97=B6=EF=BC=8C=E5=BD=A9=E8=9B=8B?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mitmproxy/src/lib/proxy/middleware/overwall.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/mitmproxy/src/lib/proxy/middleware/overwall.js b/packages/mitmproxy/src/lib/proxy/middleware/overwall.js index 7b15a34..a1ab44e 100644 --- a/packages/mitmproxy/src/lib/proxy/middleware/overwall.js +++ b/packages/mitmproxy/src/lib/proxy/middleware/overwall.js @@ -15,7 +15,7 @@ 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) { @@ -23,7 +23,7 @@ function matched (hostname, overWallTargetMap) { return 'overwall pac' } else { log.debug(`matchHostname: matched overwall: Not-Matched '${hostname}' -> '${ret}' in pac.txt`) - return false + return null } } @@ -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 @@ -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__'