From 930b81387b8e343b35ebbefb521b237bc0018707 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Tue, 18 Mar 2014 08:56:13 +0100
Subject: [PATCH] trynextip: don't store 'ai' on failed connects...

It leads to the "next family" tries starting from the wrong point and thus
fails!

Bug: http://curl.haxx.se/bug/view.cgi?id=1337
Reported-by: ricker
---
 lib/connect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/connect.c b/lib/connect.c
index 5a376c34aa..90283fe85c 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -570,11 +570,11 @@ static CURLcode trynextip(struct connectdata *conn,
 
       if(ai) {
         rc = singleipconnect(conn, ai, &conn->tempsock[tempindex]);
-        conn->tempaddr[tempindex] = ai;
         if(rc == CURLE_COULDNT_CONNECT) {
           ai = ai->ai_next;
           continue;
         }
+        conn->tempaddr[tempindex] = ai;
       }
       break;
     }
-- 
GitLab