diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-06-09 00:22:02 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-06-09 00:22:02 +0200 |
commit | 20ac3458068b2bd11c3ce802f091af66b55e2c23 (patch) | |
tree | 5c39522dfcf7c26d0d40a7469a13e54f7a946dad /lib | |
parent | eaeeed2e8f20775421beacfbd394ff4fe99ab685 (diff) | |
download | curl-20ac3458068b2bd11c3ce802f091af66b55e2c23.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connect.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c index fc72c56fe..7202fa639 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -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 */ |