You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2012/01/04 21:41:11 UTC

svn commit: r1227311 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/util/url/BasicURLHandler.java src/java/org/apache/ivy/util/url/HttpClientHandler.java

Author: maartenc
Date: Wed Jan  4 20:41:10 2012
New Revision: 1227311

URL: http://svn.apache.org/viewvc?rev=1227311&view=rev
Log:
FIX: cannot resolve from repositories that return HTTP 204 in response to an HTTP HEAD request (IVY-1328)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1227311&r1=1227310&r2=1227311&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Jan  4 20:41:10 2012
@@ -138,6 +138,7 @@ for detailed view of each issue, please 
 - IMPROVEMENT: ivy:retrieve can now convert 'dotted'-organisation names into a directory tree.
 - IMPROVEMENT: ivy:retrieve now accepts a nested mapper type.
 
+- FIX: cannot resolve from repositories that return HTTP 204 in response to an HTTP HEAD request (IVY-1328)
 - FIX: extra attributes lost from info when ivy file is merged with parent (IVY-1206)
 - FIX: ivy:report ant task intermittently "cannot compile stylesheet" (IVY-1325)
 - FIX: Maven 'eclipse-plugin', 'jbi-component' and 'jbi-shared-library' packaging is now mapped to 'jar' extension (IVY-899)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java?rev=1227311&r1=1227310&r2=1227311&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java Wed Jan  4 20:41:10 2012
@@ -98,6 +98,12 @@ public class BasicURLHandler extends Abs
         if (status == HttpStatus.SC_OK) {
             return true;
         }
+        
+        // IVY-1328: some servers return a 204 on a HEAD request
+        if ("HEAD".equals(con.getRequestMethod()) && (status == 204)) {
+            return true;
+        }
+        
         Message.debug("HTTP response status: " + status + " url=" + url);
         if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
             Message.warn("Your proxy requires authentication.");

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=1227311&r1=1227310&r2=1227311&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java Wed Jan  4 20:41:10 2012
@@ -45,7 +45,6 @@ import org.apache.commons.httpclient.aut
 import org.apache.commons.httpclient.auth.CredentialsProvider;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.HeadMethod;
-import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
 import org.apache.commons.httpclient.methods.PutMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.httpclient.params.HttpMethodParams;
@@ -181,6 +180,12 @@ public class HttpClientHandler extends A
         if (status == HttpStatus.SC_OK) {
             return true;
         }
+        
+        // IVY-1328: some servers return a 204 on a HEAD request
+        if ("HEAD".equals(method.getName()) && (status == 204)) {
+            return true;
+        }
+        
         Message.debug("HTTP response status: " + status + " url=" + url);
         if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
             Message.warn("Your proxy requires authentication.");