Skip to content

Set curl post size using CURLOPT_POSTFIELDSIZE_LARGE#22842

Draft
Sjord wants to merge 2 commits into
php:masterfrom
Sjord:curl-large-post
Draft

Set curl post size using CURLOPT_POSTFIELDSIZE_LARGE#22842
Sjord wants to merge 2 commits into
php:masterfrom
Sjord:curl-large-post

Conversation

@Sjord

@Sjord Sjord commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This is a 64-bit number on all platforms. This improves support of posting files larger than 2GB.

Comment thread ext/curl/interface.c Outdated
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, ZSTR_LEN(str));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looking good you really do need the curl_off_t cast albeit size_t is unsigned and curl_off_t is not but we re safe as far as overflow goes (for now at least :)).

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.

2 participants