]> granicus.if.org Git - curl/commitdiff
connect: store IPv6 connection status after valid connection
authorDaniel Stenberg <daniel@haxx.se>
Sat, 4 Nov 2017 12:32:14 +0000 (13:32 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 9 Nov 2017 06:59:04 +0000 (07:59 +0100)
... previously it would store it already in the happy eyeballs stage
which could lead to the IPv6 bit being set for an IPv4 connection,
leading to curl not wanting to do EPSV=>PASV for FTP transfers.

Closes #2053

lib/connect.c

index 218bbcc78b0ea95d411e7e887ae05349251bed18..84a63aefdc663fd62dbb96e9f2bebb32deb95b9f 100755 (executable)
@@ -785,6 +785,9 @@ CURLcode Curl_is_connected(struct connectdata *conn,
         conn->sock[sockindex] = conn->tempsock[i];
         conn->ip_addr = conn->tempaddr[i];
         conn->tempsock[i] = CURL_SOCKET_BAD;
+#ifdef ENABLE_IPV6
+        conn->bits.ipv6 = (conn->ip_addr->ai_family == AF_INET6)?TRUE:FALSE;
+#endif
 
         /* close the other socket, if open */
         if(conn->tempsock[other] != CURL_SOCKET_BAD) {
@@ -1097,10 +1100,6 @@ static CURLcode singleipconnect(struct connectdata *conn,
     return CURLE_OK;
   }
 
-#ifdef ENABLE_IPV6
-  conn->bits.ipv6 = (addr.family == AF_INET6)?TRUE:FALSE;
-#endif
-
   if(-1 == rc) {
     switch(error) {
     case EINPROGRESS: