Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-12-05 23:12:49 -0500
committerrelves2006-12-05 23:12:49 -0500
commit9ef786b400910de230f25483bda6bbd3e6c31b4b (patch)
tree798384f146e5094e80548d021b449b7d5015cade /org.eclipse.mylyn.tasks.core
parenta28ac2b09d18dd304d399b86f9ec96be7c4d9469 (diff)
downloadorg.eclipse.mylyn.tasks-9ef786b400910de230f25483bda6bbd3e6c31b4b.tar.gz
org.eclipse.mylyn.tasks-9ef786b400910de230f25483bda6bbd3e6c31b4b.tar.xz
org.eclipse.mylyn.tasks-9ef786b400910de230f25483bda6bbd3e6c31b4b.zip
NEW - bug 166540: Task repositories cannot be used through an auth proxy
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166540
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java
index 8b869d3a0..f3522af7e 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebClientUtil.java
@@ -15,6 +15,7 @@ import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
+import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
@@ -115,6 +116,18 @@ public class WebClientUtil {
//System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
+ if (proxySettings != null && !Proxy.NO_PROXY.equals(proxySettings) && !WebClientUtil.repositoryUsesHttps(repositoryUrl) && proxySettings.address() instanceof InetSocketAddress) {
+ InetSocketAddress address = (InetSocketAddress) proxySettings.address();
+ client.getHostConfiguration().setProxy(WebClientUtil.getDomain(address.getHostName()), address.getPort());
+ if (proxySettings instanceof AuthenticatedProxy) {
+ AuthenticatedProxy authProxy = (AuthenticatedProxy) proxySettings;
+ Credentials credentials = new UsernamePasswordCredentials(authProxy.getUserName(), authProxy
+ .getPassword());
+ AuthScope proxyAuthScope = new AuthScope(address.getHostName(), address.getPort(), AuthScope.ANY_REALM);
+ client.getState().setProxyCredentials(proxyAuthScope, credentials);
+ }
+ }
+
if (user != null && password != null) {
AuthScope authScope = new AuthScope(WebClientUtil.getDomain(repositoryUrl), WebClientUtil
.getPort(repositoryUrl), AuthScope.ANY_REALM);

Back to the top