Skip to content

After having used CURLOPT_MIMEPOST once, setting it to NULL does not reset to empty POST #6455

@bagder

Description

@bagder

Forwarded from an issue posted by Christoph M. Becker on the mailing list

I did this

I wanted to send a post request with an empty body, and found that

curl_easy_setopt(handle, CURLOPT_MIMEPOST, NULL);

allows me to do so. But it does not work to reset a formerly set mimepost, e.g.

    curl_mime_init(handle);
    part = curl_mime_addpart(mime);
    // initialize part
    curl_easy_setopt(handle, CURLOPT_MIMEPOST, mime);
    curl_easy_perform(handle);
    curl_mime_free(mime);
    curl_easy_setopt(handle, CURLOPT_MIMEPOST, NULL);
    curl_easy_perform(handle);

The second curl_easy_perform() call returns CURLE_SEND_FAIL_REWIND.
Some debugging showed that part->state.state is not reset to
MIMESTATE_BEGIN in cleanup_part_content(). Is this an oversight, or am
I missing something?

I expected the following

The second *perform() to do an empty POST

curl/libcurl version

current git master

operating system

any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions