#include <curl/curl.h>
#include <cassert>
int main(int, char**) {
CURL* e = curl_easy_init();
curl_easy_setopt(e, CURLOPT_URL, "http://google.com/");
curl_easy_setopt(e, CURLOPT_CONNECT_ONLY, 1);
curl_easy_setopt(e, CURLOPT_VERBOSE, 1);
CURLM* m = curl_multi_init();
curl_multi_add_handle(m, e);
int count;
do {
curl_multi_perform(m, &count);
} while (count > 0);
CURLMsg* msg = curl_multi_info_read(m, &count);
assert(msg);
assert(count == 0);
assert(msg->easy_handle == e);
assert(msg->data.result == CURLE_OK);
curl_multi_remove_handle(m, e);
const char buf[] = "XYZ";
size_t sent;
CURLcode res = curl_easy_send(e, buf, sizeof(buf), &sent);
assert(res == CURLE_OK); // CURLE_UNSUPPORTED_PROTOCOL is returned
curl_easy_cleanup(e);
curl_multi_cleanup(m);
return 0;
}
I did this
If
CURLOPT_CONNECT_ONLYsocket was connected using mutli interface, thencurl_easy_sendreturnsCURLE_UNSUPPORTED_PROTOCOL. Here is minimal reproducer.main.cpp:
I expected the following
curl_easy_send is usable after curl_multi_remove_handle returns;
curl/libcurl version
7.84.0
operating system
Linux WSL2