1
0
mirror of synced 2025-12-08 23:08:24 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
8b22e438eb 修复HTTP代理认证头设置错误:将authenticator改为proxyAuthenticator,将Authorization改为Proxy-Authorization
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
2025-11-28 14:04:18 +00:00
copilot-swe-agent[bot]
3dbc37471e Initial plan 2025-11-28 14:00:01 +00:00
5 changed files with 10 additions and 10 deletions

View File

@@ -41,11 +41,11 @@ public class WxChannelServiceOkHttpImpl extends BaseWxChannelServiceImpl<OkHttpC
this.httpProxy = OkHttpProxyInfo.httpProxy(this.config.getHttpProxyHost(), this.config.getHttpProxyPort(), this.config.getHttpProxyUsername(), this.config.getHttpProxyPassword());
okhttp3.OkHttpClient.Builder clientBuilder = new okhttp3.OkHttpClient.Builder();
clientBuilder.proxy(this.getRequestHttpProxy().getProxy());
clientBuilder.authenticator(new Authenticator() {
clientBuilder.proxyAuthenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(WxChannelServiceOkHttpImpl.this.httpProxy.getProxyUsername(), WxChannelServiceOkHttpImpl.this.httpProxy.getProxyPassword());
return response.request().newBuilder().header("Authorization", credential).build();
return response.request().newBuilder().header("Proxy-Authorization", credential).build();
}
});
this.httpClient = clientBuilder.build();

View File

@@ -86,12 +86,12 @@ public class WxCpServiceOkHttpImpl extends BaseWxCpServiceImpl<OkHttpClient, OkH
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
clientBuilder.proxy(getRequestHttpProxy().getProxy());
//设置授权
clientBuilder.authenticator(new Authenticator() {
clientBuilder.proxyAuthenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(httpProxy.getProxyUsername(), httpProxy.getProxyPassword());
return response.request().newBuilder()
.header("Authorization", credential)
.header("Proxy-Authorization", credential)
.build();
}
});

View File

@@ -108,12 +108,12 @@ public class WxCpTpServiceOkHttpImpl extends BaseWxCpTpServiceImpl<OkHttpClient,
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
clientBuilder.proxy(getRequestHttpProxy().getProxy());
//设置授权
clientBuilder.authenticator(new Authenticator() {
clientBuilder.proxyAuthenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(httpProxy.getProxyUsername(), httpProxy.getProxyPassword());
return response.request().newBuilder()
.header("Authorization", credential)
.header("Proxy-Authorization", credential)
.build();
}
});

View File

@@ -32,12 +32,12 @@ public class WxMaServiceOkHttpImpl extends BaseWxMaServiceImpl<OkHttpClient, OkH
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
clientBuilder.proxy(getRequestHttpProxy().getProxy());
//设置授权
clientBuilder.authenticator(new Authenticator() {
clientBuilder.proxyAuthenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(httpProxy.getProxyUsername(), httpProxy.getProxyPassword());
return response.request().newBuilder()
.header("Authorization", credential)
.header("Proxy-Authorization", credential)
.build();
}
});

View File

@@ -80,11 +80,11 @@ public class WxQidianServiceOkHttpImpl extends BaseWxQidianServiceImpl<OkHttpCli
clientBuilder.proxy(getRequestHttpProxy().getProxy());
// 设置授权
clientBuilder.authenticator(new Authenticator() {
clientBuilder.proxyAuthenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(httpProxy.getProxyUsername(), httpProxy.getProxyPassword());
return response.request().newBuilder().header("Authorization", credential).build();
return response.request().newBuilder().header("Proxy-Authorization", credential).build();
}
});
httpClient = clientBuilder.build();