Skip to content

Use curl_mime_*() functions if available #4032

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

Closed
wants to merge 1 commit into from
Closed

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Apr 15, 2019

As of curl 7.56.0, curl_formadd() is deprecated in favor of
curl_mime_*(), so we use the latter if available.

See also curl/curl#3675 (comment).

/cc @weltling, @adoy

As of curl 7.56.0, `curl_formadd()` is deprecated in favor of
`curl_mime_*()`, so we use the latter if available.
@adoy
Copy link
Member

adoy commented Apr 15, 2019

Looks good to me 👍 Good job @cmb69

@weltling
Copy link
Contributor

@cmb69 a test should be added based on the original report and dealing with multibyte filenames.

Thanks.

return FAILURE;
}
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
|| (form_error = curl_mime_filedata(part, ZSTR_VAL(postval))) != CURLE_OK
Copy link
Contributor

@weltling weltling Apr 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done through a callback, please see @bagder's comment about curl_mime_data_cb. The callback should be integrated with PHP streams. That would not only solve the memory issue with huge files, but also would make diverse streams usable.

Thanks.

Thanks.

@cmb69
Copy link
Member Author

cmb69 commented Apr 16, 2019

@weltling, this PR is not about Unicode filepath support, but only about using curl_mime_*() instead of the deprecated curl_formadd(); the functionality should be identical than before (and is already tested by several existing tests). I have a patch for the Unicode filepath support basically ready, but this might be controversial, since it would support arbitrary seekable streams.

@cmb69
Copy link
Member Author

cmb69 commented Apr 16, 2019

Applied as a83b68b. Thanks.

@cmb69 cmb69 closed this Apr 16, 2019
@cmb69 cmb69 deleted the curl_mime branch April 16, 2019 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants