mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
use proxies util class to determine if proxy settings should be used
This commit is contained in:
@@ -271,8 +271,7 @@ public class URLHttpClient implements HttpClient
|
||||
* @param password
|
||||
*/
|
||||
private void appendBasicAuthHeader(HttpURLConnection connection,
|
||||
String header, String username,
|
||||
String password)
|
||||
String header, String username, String password)
|
||||
{
|
||||
if (Util.isNotEmpty(username) || Util.isNotEmpty(password))
|
||||
{
|
||||
@@ -533,20 +532,21 @@ public class URLHttpClient implements HttpClient
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
|
||||
// TODO improve
|
||||
request = new HttpRequest(url.toExternalForm());
|
||||
}
|
||||
|
||||
HttpURLConnection connection = null;
|
||||
|
||||
if (!request.isIgnoreProxySettings() && configuration.isEnableProxy())
|
||||
if (!request.isIgnoreProxySettings()
|
||||
&& Proxies.isEnabled(configuration, url))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("fetch '{}' using proxy {}:{}",
|
||||
new Object[] { url.toExternalForm(),
|
||||
configuration.getProxyServer(),
|
||||
configuration.getProxyPort() });
|
||||
configuration.getProxyServer(), configuration.getProxyPort() });
|
||||
}
|
||||
|
||||
SocketAddress address =
|
||||
@@ -595,8 +595,8 @@ public class URLHttpClient implements HttpClient
|
||||
|
||||
connection.setRequestProperty(HEADER_ACCEPT_ENCODING,
|
||||
HEADER_ACCEPT_ENCODING_VALUE);
|
||||
connection.setRequestProperty(
|
||||
HEADER_USERAGENT, HEADER_USERAGENT_VALUE.concat(context.getVersion()));
|
||||
connection.setRequestProperty(HEADER_USERAGENT,
|
||||
HEADER_USERAGENT_VALUE.concat(context.getVersion()));
|
||||
|
||||
String username = configuration.getProxyUser();
|
||||
String password = configuration.getProxyPassword();
|
||||
|
||||
@@ -84,6 +84,7 @@ import java.util.Set;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import sonia.scm.net.Proxies;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -215,7 +216,7 @@ public class AetherPluginHandler
|
||||
RemoteRepository rr = new RemoteRepository(repository.getId(), "default",
|
||||
repository.getUrl());
|
||||
|
||||
if (configuration.isEnableProxy())
|
||||
if (Proxies.isEnabled(configuration, rr.getHost()))
|
||||
{
|
||||
Proxy proxy = DefaultProxySelector.createProxy(configuration);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user