]> granicus.if.org Git - curl/commitdiff
connect: return CURLE_OPERATION_TIMEDOUT for errno == ETIMEDOUT
authorDaniel Stenberg <daniel@haxx.se>
Fri, 4 Oct 2019 11:29:04 +0000 (13:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 9 Oct 2019 12:16:28 +0000 (14:16 +0200)
Previosly all connect() failures would return CURLE_COULDNT_CONNECT, no
matter what errno said.

This makes for example --retry work on these transfer failures.

Reported-by: Nathaniel J. Smith
Fixes #4461
Clsoes #4462

lib/connect.c

index 77196250de85c6fc21c63954c5f1a1f4fac215b9..bb2275e4da14bdc09fe14319688ada9a990bb8af 100644 (file)
@@ -976,6 +976,14 @@ CURLcode Curl_is_connected(struct connectdata *conn,
     failf(data, "Failed to connect to %s port %ld: %s",
           hostname, conn->port,
           Curl_strerror(error, buffer, sizeof(buffer)));
+
+#ifdef WSAETIMEDOUT
+    if(WSAETIMEDOUT == data->state.os_errno)
+      result = CURLE_OPERATION_TIMEDOUT;
+#elif defined(ETIMEDOUT)
+    if(ETIMEDOUT == data->state.os_errno)
+      result = CURLE_OPERATION_TIMEDOUT;
+#endif
   }
 
   return result;