Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 19859 invoked from network); 25 Aug 2008 11:06:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Aug 2008 11:06:05 -0000 Received: (qmail 43729 invoked by uid 500); 25 Aug 2008 11:06:03 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 43682 invoked by uid 500); 25 Aug 2008 11:06:03 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 43672 invoked by uid 99); 25 Aug 2008 11:06:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Aug 2008 04:06:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Aug 2008 11:05:14 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 381BE234C1AC for ; Mon, 25 Aug 2008 04:05:44 -0700 (PDT) Message-ID: <1456534757.1219662344225.JavaMail.jira@brutus> Date: Mon, 25 Aug 2008 04:05:44 -0700 (PDT) From: "Jim Bonanno (JIRA)" To: notifications@ant.apache.org Subject: [jira] Updated: (IVY-885) Invalid URL when using dynamic ranges In-Reply-To: <1539122024.1219321004395.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/IVY-885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jim Bonanno updated IVY-885: ---------------------------- Description: 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().equals("http") || url.getProtocol().equals("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. was: 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. > 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().equals("http") || url.getProtocol().equals("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.