cf-socket: if socket is already connected, return CURLE_OK

In 7.87.0, if callback method for CURLOPT_SOCKOPTFUNCTION returns
CURL_SOCKOPT_ALREADY_CONNECTED then curl library used to return
CURLE_OK.  n 7.88.0, now even if callback returns
CURL_SOCKOPT_ALREADY_CONNECTED, curl library still tries to connect to
socket by invoking method do_connect().

This is regression caused by commit
https://github.com/curl/curl/commit/71b7e0161032927cdfb

Fix: Check if we are already connected and return CURLE_OK.

Fixes #10626
Closes #10648
This commit is contained in:
Shankar Jadhavar 2023-03-01 14:32:08 +05:30 committed by Daniel Stenberg
parent d36c632c86
commit 233810bb5f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1071,6 +1071,11 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf,
if(result)
goto out;
if(cf->connected) {
*done = TRUE;
return CURLE_OK;
}
/* Connect TCP socket */
rc = do_connect(cf, data, cf->conn->bits.tcp_fastopen);
if(-1 == rc) {