Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl_mime_init man page: handle must be final target handle #10834

CosmicToast opened this issue Mar 24, 2023 · 4 comments

curl_mime_init man page: handle must be final target handle #10834

CosmicToast opened this issue Mar 24, 2023 · 4 comments


Copy link

easy_handle is used for part separator randomization and error reporting. It does not need to be the final target handle.

This is incorrect, easy_handle must be the exact handle that the curl_mime will be given to, at least with HTTP.

To reproduce:

#include <assert.h>
#include <curl/curl.h>

int main() {
	CURL *handle = curl_easy_init();
	CURL *cinit  = curl_easy_init();
	curl_mime *mime = curl_mime_init(cinit);
	curl_easy_setopt(handle, CURLOPT_URL, "");
	curl_easy_setopt(handle, CURLOPT_POST, 1);
	assert(curl_easy_setopt(handle, CURLOPT_MIMEPOST, mime) == CURLE_OK); // this throws
	return 0;

If the example is changed to curl_mime_init(handle), everything works as expected.

Copy link

bagder commented Mar 24, 2023

/cc @monnerat

CosmicToast added a commit to CosmicToast/jurl that referenced this issue Mar 24, 2023
tl;dr jurl now discovers libcurl bugs due to how complete it is
Copy link

jay commented Mar 25, 2023

What's your curl_version()? I can't reproduce this. I tried curl-8_0_1 and master fe55a63 2023-03-24, in Windows and Linux.

curl 8.1.0-DEV (x86_64-pc-linux-gnu) libcurl/8.1.0-DEV OpenSSL/3.1.0 zlib/1.2.8 nghttp2/1.52.0 librtmp/2.3
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS Debug HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP TrackMemory UnixSockets

Copy link

This works perfectly.
IMO, you probably run your binary with an old shared library (< 7.87.0). Printing curl_version() will give you a clue.
Ref: eb559c8

Copy link

I was testing against multiple curl versions and platforms, specifically 7.85.0, 7.86.0, and 8.0.1.
The latter was last, leading to the conclusion, sorry!
Would it be possible to note the version in which the requirement was relaxed?
Many people still use those curl versions, and for libcurl wrappers (like what I'm writing) you do need to make sure things work on such older versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging a pull request may close this issue.

4 participants