Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1575

PoolingHttpClientConnectionManager.setMaxPerRoute accepts, but ignores, HttpRoutes with default ports

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • HttpClient (classic)
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            joe@kafsemo.org Joseph Walton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: