[ 
https://issues.apache.org/jira/browse/IVY-885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624654#action_12624654
 ] 

Jim Bonanno commented on IVY-885:
---------------------------------

You are correct. I just ran this test against apache as well. I was under the 
impression that escaping a second time was not an issue., which is not true.

Any suggestions of  how I can fix this problem, The uri with a dynamic range is 
not properly escaped. Is there a way I can have Ivy detect that the revision is 
dynamic and to immediately switch over to listing? 

Also seems like this issue can come up if a module name is created with a 
space. The schema for module name is xs:string which also can allow for 
characters that need to be escaped.

> Invalid URL when using dynamic ranges
> -------------------------------------
>
>                 Key: IVY-885
>                 URL: https://issues.apache.org/jira/browse/IVY-885
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-beta-1
>            Reporter: Jim Bonanno
>
> Sorry to have two url issues in one day. 
> We are using ivy's ranges to resolve our modules. Ivy first tries to see if 
> the specified version exists before listing the repository. The issue that we 
> hit was when using the range [1,2[. The first request is 
> http://myhost/my-repo/org/module/ivys/ivy-[1,2[.xml.
> This URL is not properly escaped, but apache apparently is very forgiving. 
> When we hosted the ivy repository with another web server that validated the 
> urls the returned status code was not a 404.
> We are working around the problem by again using URI to build the URL so it 
> gets properly escaped. There seems to be some tricks to using the URI class. 
> For example, the constructor that takes a string requires the string is 
> already rfc 2396 compliant. The other constructors will actually escape the 
> URL.
> Here is the modifications we made to the BasicURLHandler.
>         if ( url.getProtocol() == "http" || url.getProtocol() == "https") {
>             try {
>                 URI uri = new URI(url.getProtocol(), null, url.getHost(), 
> url.getPort(), url.getPath(), null, null);
>                 url = uri.toURL();
>             }
>             catch ( URISyntaxException e ) {
>                 IOException ioe = new IOException("Couldn't open connection 
> to '" + url.toString() + "'");
>                 ioe.initCause(e);
>                 throw ioe;
>             }
>         }
>         con = url.openConnection();
> which results in a request 
> http://myhost/my-repo/org/module/ivys/ivy-%5B1,2%5B.xml.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to