Skip to content

feat(libcurl): implement curl_mime_data_cb - #18316

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
alvaroelpob:feat/curl-mime-data-cb
Nov 12, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
alvaroelpob:feat/curl-mime-data-cb

Conversation

@alvaroelpob

@alvaroelpob alvaroelpob commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements curl_mime_data_cb, which threw through NotImplemented_nid_no_patch.

The part gets host read, seek and free callbacks that call the guest functions with the guest arg, through a context shared by the part and the copies curl_easy_duphandle makes of it. In curl 7.81.0 Curl_mime_duppart (mime.c) gives each copy the same readfunc, seekfunc, freefunc and arg, so the guest free function runs once per copy, as it does here. To know when the last holder is gone, the adapter follows curl_mime_addpart, curl_mime_subparts, curl_mime_data, curl_mime_filedata, curl_mime_free, CURLOPT_MIMEPOST, curl_easy_duphandle, curl_easy_reset and curl_easy_cleanup: the context lives while a part still holds it or a duplicate handle holds a copy, which matches when 7.81.0 frees part contents (cleanup_part_content, Curl_mime_set_subparts). A null readfunc stores nothing, as upstream. curl_easy_duphandle is the only caller of Curl_mime_duppart in 7.81.0.

The debt entry for the export is replaced by a MIME callbacks entry: whether the console also calls the free function once per copy is unverified.

Tested

Linux (WSL2, Ubuntu): full build and suite on fddd10b, 4863/4863 tests pass; check_conventions passes. The new guest_curl_mimecallback posts a callback part through a duplicated handle to a loopback HTTP server after the original mime is freed, and checks the guest free function runs once per copy, on content replacement and through owned subparts.

Checklist

@github-actions

Copy link
Copy Markdown

Progress report (14bff3f → fddd10b)

📈 System libraries: 36.78% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libcurl curl_mime_data_cb_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libcurl 56/85 (65.88%) 57/85 (67.06%) +1.18%

@github-actions

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 14212 docs/dev/debt/libcurl.md

@JJenkx

JJenkx commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Windows check of head fddd10b9ad, merged onto main ce111157b8 (f547034b12, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_curl, guest_curl_strings pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@alvaroelpob
alvaroelpob marked this pull request as ready for review November 11, 2026 17:06
@oneandonlydean
oneandonlydean merged commit 0c558e2 into boykopovar:main Nov 12, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants