Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 56037 invoked from network); 3 Apr 2010 18:25:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Apr 2010 18:25:51 -0000 Received: (qmail 68468 invoked by uid 500); 3 Apr 2010 18:25:51 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 68440 invoked by uid 500); 3 Apr 2010 18:25:51 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 68361 invoked by uid 99); 3 Apr 2010 18:25:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Apr 2010 18:25:51 +0000 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; Sat, 03 Apr 2010 18:25:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3B517234C48C for ; Sat, 3 Apr 2010 18:25:27 +0000 (UTC) Message-ID: <1300066763.675911270319127241.JavaMail.jira@brutus.apache.org> Date: Sat, 3 Apr 2010 18:25:27 +0000 (UTC) From: "Oleg Kalnichevski (JIRA)" To: dev@hc.apache.org Subject: [jira] Resolved: (HTTPCLIENT-929) Request with two forward slashes for path fails In-Reply-To: <1049448255.659581270216107459.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HTTPCLIENT-929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski resolved HTTPCLIENT-929. ------------------------------------------ Resolution: Fixed Fixed in SVN trunk http://svn.apache.org/viewvc?rev=930558&view=rev I looked at #relativize method but felt it was an overkill. I opted for a simpler and likely faster custom routine. Please review. Oleg > Request with two forward slashes for path fails > ----------------------------------------------- > > Key: HTTPCLIENT-929 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-929 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0.1 > Reporter: Ryan Stewart > Fix For: 4.1 Alpha2 > > > The following code demonstrates the problem: > DefaultHttpClient client = new DefaultHttpClient(); > client.execute(new HttpGet("http://www.google.com//")); > When a request is made, the DefaultRequestDirector invokes rewriteRequestURI(). I don't fully understand why this method does what it does. For a non-proxied request, it attempts to render the URI to a relative URI. In doing so, it tries to create a relative URI whose content is "//". Per RFC 2396 section 5 (Relative URI References), a relative URI that begins with "//" is a network-path reference, and the "//" must be immediately followed by an authority. Therefore, while "http://www.google.com//" is a valid absolute URI, "//" is not a valid relative one. The resulting exception: > [...] > Caused by: org.apache.http.ProtocolException: Invalid URI: http://www.google.com// > at org.apache.http.impl.client.DefaultRequestDirector.rewriteRequestURI(DefaultRequestDirector.java:339) > at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:434) > at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641) > ... 31 more > Caused by: java.net.URISyntaxException: Expected authority at index 2: // > at java.net.URI$Parser.fail(URI.java:2809) > at java.net.URI$Parser.failExpecting(URI.java:2815) > at java.net.URI$Parser.parseHierarchical(URI.java:3063) > at java.net.URI$Parser.parse(URI.java:3024) > at java.net.URI.(URI.java:578) > at org.apache.http.client.utils.URIUtils.createURI(URIUtils.java:106) > at org.apache.http.client.utils.URIUtils.rewriteURI(URIUtils.java:141) > at org.apache.http.client.utils.URIUtils.rewriteURI(URIUtils.java:159) > at org.apache.http.impl.client.DefaultRequestDirector.rewriteRequestURI(DefaultRequestDirector.java:333) > ... 33 more -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org