Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8305906

HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address

XMLWordPrintable

    • b26

        The java.net.http.HttpClient internally uses pooled connections. When pooling HTTP/2 connections, the key used includes the InetAddress.getHostString() of the peer. When looking up a pooled connection for incoming requests, the client uses the request URI's getHost() method to lookup the connection.

        When IPv6 addesses are involved, URI.getHost() method, as noted in its API documentation, returns an IP address wrapped in square brackets. On the other hand, the InetAddress.getHostString(), doesn't use square brackets to represent the IP address.

        This thus leads to a mismatch in the keys used to store the connection and retrieve the connection, effectively leading to a cache miss on lookup.

              jpai Jaikiran Pai
              jpai Jaikiran Pai
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: