hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Walton (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HTTPCLIENT-1575) PoolingHttpClientConnectionManager.setMaxPerRoute accepts, but ignores, HttpRoutes with default ports
Date Sun, 09 Nov 2014 13:25:33 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Joseph Walton updated HTTPCLIENT-1575:
    Attachment: HTTPCLIENT-1575-fail-on-httproute-without-explicit-target-port.diff

As suggested, I've attached a patch that fails when an {{HttpRoute}} is passed an {{HttpHost}}
without an explicit port, along with a test.

This impacts a number of tests which call {{new HttpRoute(new HttpHost("hostname"))}}, which
is now a runtime error, and the patch includes fixes. I suspect this same error will occur
with client code, although it's not a difficult fix.

> PoolingHttpClientConnectionManager.setMaxPerRoute accepts, but ignores, HttpRoutes with
default ports
> -----------------------------------------------------------------------------------------------------
>                 Key: HTTPCLIENT-1575
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1575
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>            Reporter: Joseph Walton
>         Attachments: HTTPCLIENT-1575-fail-on-httproute-without-explicit-target-port.diff,
> {{PoolingHttpClientConnectionManager.setMaxPerRoute}} can be called with an {{HttpRoute}}
constructed from an {{HttpHost}} using -1 to indicate the default port:
> {noformat}
> connectionManager.setMaxPerRoute(new HttpRoute(new HttpHost("localhost", -1, "http")));
> {noformat}
> However, when it's consulted during establishing a connection, the default port number
will have been filled in:
> {noformat}
> getMaxPerRoute(new HttpRoute(new HttpHost("localhost", 80, "http)));
> {noformat}
> The lookup for the maximum is by object equality, so this route will get the default
of 2.
> The simplest change here is to fail when an unspecified port is passed in, to indicate
that this is not supported. Alternatively, pass all {{HttpHost}} ports through {{DefaultSchemePortResolver.INSTANCE}}
before using them as keys in a map.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message