Author: maartenc
Date: Wed Oct 29 15:51:22 2008
New Revision: 709038
URL: http://svn.apache.org/viewvc?rev=709038&view=rev
Log:
FIX: Listing of URL's under a given URL does not handle fully specified URL's
(IVY-959) (thanks to Randy Nott)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=709038&r1=709037&r2=709038&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Oct 29 15:51:22 2008
@@ -84,6 +84,7 @@
trunk
=====================================
- FIX: Log levels aren't respected in certain cases using the standalone
functionality (IVY-960) (thanks to Patrick Woodworth)
+- FIX: Listing of URL's under a given URL does not handle fully specified
URL's (IVY-959) (thanks to Randy Nott)
2.0.0-rc2
=====================================
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java?rev=709038&r1=709037&r2=709038&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/ApacheURLLister.java
Wed Oct 29 15:51:22 2008
@@ -126,11 +126,26 @@
text = text.trim();
+ // handle complete URL listings
+ if (href.startsWith("http:") || href.startsWith("https:")) {
+ try {
+ href = new URL(href).getPath();
+ if (!href.startsWith(url.getPath())) {
+ // ignore URLs which aren't children of the base URL
+ continue;
+ }
+ href = href.substring(url.getPath().length());
+ } catch (Exception ignore) {
+ // incorrect URL, ignore
+ continue;
+ }
+ }
+
if (href.startsWith("../")) {
// we are only interested in sub-URLs, not parent URLs, so
skip this one
continue;
}
-
+
// absolute href: convert to relative one
if (href.startsWith("/")) {
int slashIndex = href.substring(0, href.length() -
1).lastIndexOf('/');