1. Atlassian
  2. Project: Atlassian
  3. jetbrains-bitbucket-connector

Commits

Martin Lau  committed 320db80

Added proxy support for getClient()

  • Participants
  • Parent commits c032716
  • Branches default

Comments (0)

Files changed (1)

File src/org/bitbucket/connectors/jetbrains/BitbucketUtil.java

View file
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.util.SystemProperties;
+import com.intellij.util.net.HttpConfigurable;
 import org.apache.commons.httpclient.*;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.GetMethod;
         client.getParams().setAuthenticationPreemptive(true);
         client.getState().setCredentials(AuthScope.ANY, cred);
 
+        HttpConfigurable proxyConfig = HttpConfigurable.getInstance();
+        if (proxyConfig.USE_HTTP_PROXY) {
+            client.getHostConfiguration().setProxy(proxyConfig.PROXY_HOST, proxyConfig.PROXY_PORT);
+            if (proxyConfig.PROXY_AUTHENTICATION) {
+                UsernamePasswordCredentials proxyCred = new UsernamePasswordCredentials(proxyConfig.PROXY_LOGIN, proxyConfig.getPlainProxyPassword());
+                client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
+            }
+        }
+
         return client;
     }