[
https://issues.apache.org/jira/browse/HTTPCLIENT-1575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14206529#comment-14206529
]
Oleg Kalnichevski commented on HTTPCLIENT-1575:
-----------------------------------------------
Patch committed to SVN trunk. Many thanks, Joseph, for contributing it. I
certainly think this is the right behavior. However, how would you feel about
using standard default ports (80 and 443) in case of default port value instead
of throwing IllegalArgumentException for 4.4 series? It is not ideal given that
one can override the standard values by using a custom SchemePortResolver but
would likely break fewer applications written against 4.3 APIs. What do you
think?
Oleg
> 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,
> HTTPCLIENT-1575-fail-when-setmaxperroute-uses-default-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
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]