Skip to content

UNSUPPORTED_PROTOCOL from curl_easy_send on handle removed from curl_multi #9244

@redbaron

Description

@redbaron

I did this

If CURLOPT_CONNECT_ONLY socket was connected using mutli interface, then curl_easy_send returns CURLE_UNSUPPORTED_PROTOCOL. Here is minimal reproducer.

main.cpp:

#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 expected the following

curl_easy_send is usable after curl_multi_remove_handle returns;

curl/libcurl version

7.84.0

operating system

Linux WSL2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions