easy: make curl_easy_perform() return error if connection still there

This typically happens if CURL_CONNECT_ONLY is used and a second
curl_easy_perform() is attempted.

A connection "taken over" with CURL_CONNECT_ONLY cannot be ended any
other way than a curl_easy_cleanup() on the easy handle that holds it.

Add test 696 to verify.

Closes #16003
This commit is contained in:
Daniel Stenberg 2025-01-14 15:47:21 +01:00
parent 2f8ecd5dbd
commit be82a3605a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 71 additions and 1 deletions

View file

@ -751,6 +751,11 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
if(data->conn) {
failf(data, "cannot use again while associated with a connection");
return CURLE_BAD_FUNCTION_ARGUMENT;
}
if(data->set.errorbuffer)
/* clear this as early as possible */
data->set.errorbuffer[0] = 0;