aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/org')
-rw-r--r--id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java b/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java
index 04e9a8ab9..751e27b95 100644
--- a/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java
+++ b/id/server/moa-id-commons/src/main/java/org/apache/commons/httpclient/MOAHttpClient.java
@@ -45,6 +45,7 @@ public class MOAHttpClient extends HttpClient {
public MOAHttpClient() {
super();
+ injectProxyCredentials();
}
@@ -93,8 +94,12 @@ public class MOAHttpClient extends HttpClient {
HttpState interalState = (state == null ? getState() : state);
- if (requiresProxy(uri.getURI())) {
- injectProxyCredentials(hostconfig, interalState);
+ if (!requiresProxy(uri.getURI())
+ && MiscUtil.isNotEmpty(hostconfig.getProxyHost())) {
+ Logger.info("RequestURL is on proxy-ignore list. Remove proxy from request", null);
+ hostconfig.setProxyHost(null);
+
+
}
@@ -102,12 +107,12 @@ public class MOAHttpClient extends HttpClient {
getHttpConnectionManager(),
hostconfig,
getParams(),
- state);
+ interalState);
methodDirector.executeMethod(method);
return method.getStatusCode();
}
- public void injectProxyCredentials(HostConfiguration hostconfig, HttpState interalState) {
+ public void injectProxyCredentials() {
//set proxy functionality
String host = System.getProperty("http.proxyHost"); //$NON-NLS-1$
String port = System.getProperty("http.proxyPort"); //$NON-NLS-1$
@@ -125,14 +130,14 @@ public class MOAHttpClient extends HttpClient {
}
}
- Logger.debug("Set HTTP-Proxy to Host: " + host + " and port: " + p);
- hostconfig.setProxy(host, p);
+ Logger.info("Set HTTP-Proxy to Host: " + host + " and port: " + p);
+ getHostConfiguration().setProxy(host, p);
if (MiscUtil.isNotEmpty(user) && pass != null) {
//set proxy credentials
AuthScope authscope = new AuthScope(host, p);
Credentials credentials = new UsernamePasswordCredentials(user, pass);
- interalState.setProxyCredentials(authscope, credentials);
- Logger.debug(" Use Proxy with Username: " + user + " and password: "
+ getState().setProxyCredentials(authscope, credentials);
+ Logger.info(" Use Proxy with Username: " + user + " and password: "
+ (Logger.isTraceEnabled() ? pass : "*******"));
}
@@ -150,8 +155,7 @@ public class MOAHttpClient extends HttpClient {
{
boolean requiresProxy = true;
final String nonProxyHosts = System.getProperty("http.nonProxyHosts");
- if (nonProxyHosts != null)
- {
+ if (nonProxyHosts != null) {
StringTokenizer tokenizer = new StringTokenizer(nonProxyHosts, "|");
while (tokenizer.hasMoreTokens())
{