Skip to content

Commit

Permalink
remove EnvironmentUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Jul 8, 2024
1 parent fe65b33 commit 13c630a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 90 deletions.
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 @@ -169,16 +169,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 13c630a

Please sign in to comment.