Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Ipv6 Support in HttpClient

Hi,

I was trying to send requests to a ipv6 enabled server over HTTP2. I observed that my :authority header was being sent without the square braces:

localhost:8080 instead of [localhost:8080]

This causes an error on the server since it treats it as an ipv4 address.

On further debugging, I can see a normalizeHost() method in HttpClient that strips off the square braces and sets this host in the HttpRequest object.

Now, HttpSenderOverHttp2 forms Metadata from this request and uses normalised host in the HpacEncoder class for forming the :authority header and hence cannot access the ipv6 address.

A possible solution that I tried was to override the HttpClient normaliseHost() and skip stripping the square braces. 

Now my question - is that the right approach? Or my understanding is lacking somewhere?

Thanks,
Chirag

Back to the top