Try all IP addrs associated with a hostname if the first fails
authorDan Winship <danw@gnome.org>
Sun, 15 Nov 2009 17:05:16 +0000 (12:05 -0500)
committerDan Winship <danw@gnome.org>
Sat, 14 Aug 2010 20:39:15 +0000 (16:39 -0400)
commitb248daf6ab6bba3c4b346dc1f2b45cb73881d05b
tree89a39f4d32bbbd164f557d036deccd15bb82898f
parentfb280d10fdb05f301141f8a90f72d5c0e34b4497
Try all IP addrs associated with a hostname if the first fails

Make SoupAddress keep track of multiple IP addresses and implement
GSocketConnectable, and make SoupSocket use GSocketClient (and thus
GSocketAddressEnumerator) to connect, so that it tries all addresses
associated with the SoupAddress.

In particular, this fixes the bug where if a host has both IPv4 and
IPv6 addresses, and glibc thinks you have IPv6 connectivity, but you
don't really, that libsoup can't connect to that host.

(Using GSocketClient rather than using GSocketAddressEnumerator
directly is a bit heavyweight for SoupSocket, since we don't actually
want to have a GSocket or GSocketConnection. But eventually, we will
be porting SoupSocket to use GSocket, and this code is a stepping
stone to that. Also, letting GSocketClient do the looping over the
addresses simplifies SoupSocket.)

(This change also silently breaks connection timeouts unless you have
the very latest git glib.)

https://bugzilla.gnome.org/show_bug.cgi?id=526321
libsoup/soup-address.c
libsoup/soup-address.h
libsoup/soup-socket.c
tests/libsoup.supp