Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
PoolingHttpClientConnectionManager.setMaxPerRoute can be called with an HttpRoute constructed from an HttpHost using -1 to indicate the default port:
connectionManager.setMaxPerRoute(new HttpRoute(new HttpHost("localhost", -1, "http")));
However, when it's consulted during establishing a connection, the default port number will have been filled in:
getMaxPerRoute(new HttpRoute(new HttpHost("localhost", 80, "http)));
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.