Skip to content

Commit

Permalink
remove EnvironmentUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Jun 12, 2024
1 parent b6a07ef commit f6c47bd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ private <T extends AcsResponse> HttpResponse doRealAction(AcsRequest<T> request,
String regionId, AlibabaCloudCredentials credentials, Signer signer, FormatType format)
throws ClientException, ServerException {


doActionWithProxy(request.getSysProtocol(), System.getenv("HTTPS_PROXY"), System.getenv("HTTP_PROXY"));
doActionWithIgnoreSSL(request, X509TrustAll.ignoreSSLCerts);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.*;
import com.aliyuncs.utils.EnvironmentUtils;
import com.aliyuncs.utils.EnvHelper;
import com.aliyuncs.utils.IOUtils;
import com.aliyuncs.utils.StringUtils;
import org.apache.http.Header;
Expand Down Expand Up @@ -271,16 +271,16 @@ private HttpUriRequest parseToHttpRequest(HttpRequest apiReq) throws IOException
}

private HttpHost calcProxy(HttpRequest apiReq) throws MalformedURLException, ClientException {
boolean needProxy = HttpUtil.needProxy(new URL(apiReq.getSysUrl()).getHost(), clientConfig.getNoProxy(), EnvironmentUtils.getNoProxy());
boolean needProxy = HttpUtil.needProxy(new URL(apiReq.getSysUrl()).getHost(), clientConfig.getNoProxy(), EnvHelper.getenv("NO_PROXY"));
if (!needProxy) {
return null;
}
URL url = new URL(apiReq.getSysUrl());
HttpHost proxy = null;
if ("https".equalsIgnoreCase(url.getProtocol())) {
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpsProxy(), EnvironmentUtils.getHttpsProxy(), apiReq);
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpsProxy(), EnvHelper.getenv("HTTPS_PROXY"), apiReq);
} else {
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpProxy(), EnvironmentUtils.getHttpProxy(), apiReq);
proxy = HttpUtil.getApacheProxy(clientConfig.getHttpProxy(), EnvHelper.getenv("HTTP_PROXY"), apiReq);
}
return proxy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.*;
import com.aliyuncs.utils.EnvironmentUtils;
import com.aliyuncs.utils.EnvHelper;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.NoopHostnameVerifier;

Expand Down Expand Up @@ -165,16 +165,16 @@ private void checkHttpRequest(HttpRequest request) {

private Proxy calcProxy(URL url, HttpRequest request) throws ClientException {
String targetHost = url.getHost();
boolean needProxy = HttpUtil.needProxy(targetHost, clientConfig.getNoProxy(), EnvironmentUtils.getNoProxy());
boolean needProxy = HttpUtil.needProxy(targetHost, clientConfig.getNoProxy(), EnvHelper.getenv("NO_PROXY"));
if (!needProxy) {
return Proxy.NO_PROXY;
}
Proxy proxy;
if ("https".equalsIgnoreCase(url.getProtocol())) {
String httpsProxy = EnvironmentUtils.getHttpsProxy();
String httpsProxy = EnvHelper.getenv("HTTPS_PROXY");
proxy = HttpUtil.getJDKProxy(clientConfig.getHttpsProxy(), httpsProxy, request);
} else {
String httpProxy = EnvironmentUtils.getHttpProxy();
String httpProxy = EnvHelper.getenv("HTTP_PROXY");
proxy = HttpUtil.getJDKProxy(clientConfig.getHttpProxy(), httpProxy, request);
}
return proxy;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.utils.AuthUtils;
import com.aliyuncs.utils.EnvHelper;
import com.aliyuncs.utils.EnvironmentUtils;

import org.junit.Assert;
import org.junit.Test;
Expand Down

This file was deleted.

0 comments on commit f6c47bd

Please sign in to comment.