Hi, I created a pull request ( https://github.com/curl/curl/pull/794 ) and just wanted to give more information about it.
Some time ago I noticed zypper was failing intermittently when connecting to the opensuse repositories. After some debugging I noticed curl itself was failing intermittently (with any connection, not related to opensuse servers). Finally I got some time to work on this and noticed that curl always tried first an ipv6 connection and, since my network is not ipv6 ready, it fell back to ipv4 as it should but then some of these connections returned a "Network is unreachable" error which was working fixed just by retrying (sometimes, a number of retries was needed). In the Curl_is_connected function there's a for loop that checks the status of two sockets (entries 0 and 1 of conn->tempsock). Sometimes conn->tempsock has one ipv6 socket, sometimes it has one ipv4 socket and sometimes it contains both ipv6 and ipv4 sockets . In the last case, one of the verifyconnect calls was setting error to 101 (Network is unreachable) and then the ipv4 socket was checked, but it didn't change the error value, so the error related to the ipv6 connection was returned. I made it set error to 0 if Curl_socket_ready returned 0 for the ipv4 socket since that means there's still one connection to check and an error shouldn't be returned. I tried compiling curl with this patch and it fixed all the problems with invalid "Network is unreachable" errors. Greetings, -- Antonio Larrosa ------------------------------------------------------------------- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
