[
https://issues.apache.org/jira/browse/HTTPCLIENT-1038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oleg Kalnichevski resolved HTTPCLIENT-1038.
-------------------------------------------
Resolution: Fixed
Fix Version/s: 4.1.0
This bit of code got committed by mistake. See HTTPCLIENT-911 for details. The
problem has been fixed in the SVN trunk. Please upgrade to the latest SVN
snapshot.
Oleg
> AbstractHttpClient.determineTarget(HttpUriRequest)
> --------------------------------------------------
>
> Key: HTTPCLIENT-1038
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1038
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.1 Beta1
> Environment: OS: windows server 2003 64-bit;
> IDE: Eclipse Java EE IDE for Web Developers, Version: Indigo Release, Build
> id: 20101216-1529;
> Java: java version "1.7.0-ea", Java(TM) SE Runtime Environment (build
> 1.7.0-ea-b83), Java HotSpot(TM) 64-Bit Server VM (build 17.0-b09, mixed mode);
> Reporter: Sree Vaddi
> Fix For: 4.1.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Issue with 4.1 beta1 fails to parse the right host from the URL, eg.
> http://my.site.com/search/?for=http://other.site.com
> This fails request for eg. REST that has a param value with ':' or '?' or '/'.
> AbstractHttpClient.determineTarget(HttpUriRequest)
> httpcomponents-client-4.0.3:
> private HttpHost determineTarget(HttpUriRequest request) {
> // A null target may be acceptable if there is a default target.
> // Otherwise, the null target is detected in the director.
> HttpHost target = null;
> URI requestURI = request.getURI();
> if (requestURI.isAbsolute()) {
> target = new HttpHost(
> requestURI.getHost(),
> requestURI.getPort(),
> requestURI.getScheme());
> }
> return target;
> }
> httpcomponents-client-4.1-beta1:
> private HttpHost determineTarget(HttpUriRequest request) throws
> ClientProtocolException {
> // A null target may be acceptable if there is a default target.
> // Otherwise, the null target is detected in the director.
> HttpHost target = null;
> URI requestURI = request.getURI();
> if (requestURI.isAbsolute()) {
> 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);
> int port = requestURI.getPort();
> String scheme = requestURI.getScheme();
> if (host == null || "".equals(host)) {
> throw new ClientProtocolException(
> "URI does not specify a valid host name: " +
> requestURI);
> }
> target = new HttpHost(host, port, scheme);
> }
> return target;
> }
--
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: [email protected]
For additional commands, e-mail: [email protected]