Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 65172 invoked from network); 5 Jan 2011 11:00:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jan 2011 11:00:10 -0000 Received: (qmail 34822 invoked by uid 500); 5 Jan 2011 11:00:10 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 34618 invoked by uid 500); 5 Jan 2011 11:00:08 -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 34598 invoked by uid 99); 5 Jan 2011 11:00:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jan 2011 11:00:07 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jan 2011 11:00:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p05AxkAX025239 for ; Wed, 5 Jan 2011 10:59:46 GMT Message-ID: <17941686.158121294225186355.JavaMail.jira@thor> Date: Wed, 5 Jan 2011 05:59:46 -0500 (EST) From: "Oleg Kalnichevski (JIRA)" To: dev@hc.apache.org Subject: [jira] Resolved: (HTTPCLIENT-1039) AbstractHttpClient.determineTarget does not recognize target host correctly In-Reply-To: <32745344.157791294224229603.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski resolved HTTPCLIENT-1039. ------------------------------------------- Resolution: Fixed Fix Version/s: 4.1.0 > AbstractHttpClient.determineTarget does not recognize target host correctly > --------------------------------------------------------------------------- > > Key: HTTPCLIENT-1039 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1039 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.1 Beta1 > Reporter: Marco Rocci > Fix For: 4.1.0 > > > I am trying to execute an HttpGet with the following URI: > "http://www.foo.foo/doSomething.html?url=http://www.bar.bar/doSomethingElse.html" > This leads to UnknownHostException > Going through the internal code, the problem seems to be in the AbstractHttpClient.determineTarget method: > String ssp = requestURI.getSchemeSpecificPart(); > ssp = ssp.substring(2, ssp.length()); //remove "//" prefix > int end = ssp.indexOf(':') > 0 ? ssp.indexOf(':') : > ssp.indexOf('/') > 0 ? ssp.indexOf('/') : > ssp.indexOf('?') > 0 ? ssp.indexOf('?') : ssp.length(); > String host = ssp.substring(0, end); > This code sets the target host to "www.foo.foo/doSomething.html?url=http" instead of "www.foo.foo". This obviously breaks the execution not far down the line... DefaultClientConnectionOperator.resolveHostname throws an UnknownHostException. > FWIW the AbstractHttpClient.determineTarget method actually has access to the request URI object, which correctly states that the host is "www.foo.foo". > So why does it try to extract the host from the scheme specific part anyway? > I hope this is useful... and if there is any workaround please let me know, as I'm stuck on this one. > Marco -- 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