Hi,

On Wed, Dec 21, 2022 at 8:33 AM Matthias Pfau via jetty-users
<jetty-users@eclipse.org> wrote:
>
> Hi there,
> with jetty 11, we bind the http client to an ipv4 address as follows:
>
> httpClient.setBindAddress(new 
> InetSocketAddress(serverConfig.getIpv4Address(), 0));
>
> We lately noticed, that this client can't connect to certain websites:
>
> java.util.concurrent.ExecutionException: java.net.SocketException: Could not 
> connect to www.dan.me.uk/[2001:67c:26b4:2:21e:bff:fec7:87a]:443 
> <http://www.dan.me.uk/[2001:67c:26b4:2:21e:bff:fec7:87a]:443>      at 
> org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:113)
>       at 
> org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:96)
>      at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:771)      
> at org.eclipse.jetty.client.HttpClient.GET(HttpClient.java:351) at 
> org.eclipse.jetty.client.HttpClient.GET(HttpClient.java:336)
> It seems like the client that was bound to the ipv4 address tries to connect 
> to the ipv6 address of www.dan.me.uk <http://www.dan.me.uk> which is 
> impossible.
>
> Did we miss something or is this a bug?

>From https://docs.oracle.com/javase/8/docs/technotes/guides/net/ipv6_guide/:

"f a socket is bound to an IPv6 anylocal address on a dual-stack
machine, it can accept both IPv6 and IPv4 traffic; if it is bound to
an IPv4 (IPv4-mapped) anylocal address, it can only accept IPv4
traffic".

Seems that the scenario you have is not supported by the JDK.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to