CURLOPT_OPENSOCKETFUNCTION: return error at once

When CURL_SOCKET_BAD is returned in the callback, it should be treated
as an error (CURLE_COULDNT_CONNECT) if no other socket is subsequently
created when trying to connect to a server.

Bug: http://curl.haxx.se/mail/lib-2015-06/0047.html
This commit is contained in:
Daniel Stenberg
2015-06-09 00:22:02 +02:00
parent eaeeed2e8f
commit 20ac345806
5 changed files with 104 additions and 3 deletions

View File

@@ -1166,8 +1166,11 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
conn->tempaddr[0] = conn->tempaddr[0]->ai_next;
}
if(conn->tempsock[0] == CURL_SOCKET_BAD)
if(conn->tempsock[0] == CURL_SOCKET_BAD) {
if(!result)
result = CURLE_COULDNT_CONNECT;
return result;
}
data->info.numconnects++; /* to track the number of connections made */