You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by ma...@apache.org on 2007/09/21 14:42:25 UTC

svn commit: r578149 - in /incubator/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/util/url/IvyAuthenticator.java

Author: maartenc
Date: Fri Sep 21 07:42:25 2007
New Revision: 578149

URL: http://svn.apache.org/viewvc?rev=578149&view=rev
Log:
FIX: Ivy:retrieve fails through proxy server (IVY-529)

Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?rev=578149&r1=578148&r2=578149&view=diff
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Fri Sep 21 07:42:25 2007
@@ -51,6 +51,7 @@
 
    version in SVN
 =====================================
+- FIX: Ivy:retrieve fails through proxy server (IVY-529)
 - FIX: java.lang.IllegalArgumentException: Invalid uri when working with version ranges (IVY-390)
 - FIX: Ivy settings include -tag url attribute does not work correctly (IVY-601)
 - FIX: Static revision replacement is not working when a dynamic revision is evicted by a transitive dependency (IVY-603) (with contribution from Matthias Kilian)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java?rev=578149&r1=578148&r2=578149&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java Fri Sep 21 07:42:25 2007
@@ -47,13 +47,28 @@
     // Overriding Authenticator *********************************************
 
     protected PasswordAuthentication getPasswordAuthentication() {
-        Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
-            getRequestingHost());
-        Message.debug("authentication: k='"
-                + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c
-                + "'");
-        return c != null ? new PasswordAuthentication(c.getUserName(), c.getPasswd().toCharArray())
-                : null;
+        PasswordAuthentication result = null;
+        
+        String proxyHost = System.getProperty("http.proxyHost");
+        if (getRequestingHost().equals(proxyHost)) {
+            String proxyUser = System.getProperty("http.proxyUser");
+            if ((proxyUser != null) && (proxyUser.trim().length() > 0)) {
+                String proxyPass = System.getProperty("http.proxyPassword", "");
+                Message.debug("authenicating to proxy server with username [" + proxyUser + "]");
+                result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray());
+            }
+        } else {
+            Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
+                getRequestingHost());
+            Message.debug("authentication: k='"
+                    + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c
+                    + "'");
+            if (c != null) {
+                result = new PasswordAuthentication(c.getUserName(), c.getPasswd().toCharArray());
+            }
+        }
+        
+        return result;
     }
 
 }