Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 82488 invoked from network); 5 Jan 2011 11:18:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jan 2011 11:18:13 -0000 Received: (qmail 51942 invoked by uid 500); 5 Jan 2011 11:18:13 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 50615 invoked by uid 500); 5 Jan 2011 11:18:10 -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 50606 invoked by uid 99); 5 Jan 2011 11:18:09 -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:18:09 +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:18:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p05BHlor025535 for ; Wed, 5 Jan 2011 11:17:47 GMT Message-ID: <32529577.158491294226267009.JavaMail.jira@thor> Date: Wed, 5 Jan 2011 06:17:47 -0500 (EST) From: "Marco Rocci (JIRA)" To: dev@hc.apache.org Subject: [jira] Commented: (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:comment-tabpanel&focusedCommentId=12977738#action_12977738 ] Marco Rocci commented on HTTPCLIENT-1039: ----------------------------------------- Thanks Oleg. I'm sorry I opened a duplicate issue. I searched through the open ones, but I didn't think of going through the solved issues. I'll get the SVN trunk version then. Marco > 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