Skip to content

Commit 6c3ba33

Browse files
committed
Set curl post size using CURLOPT_POSTFIELDSIZE_LARGE
This is a 64-bit number on all platforms. This improves support of posting files larger than 2GB. - https://curl.se/libcurl/c/CURLOPT_POSTFIELDSIZE.html - https://curl.se/libcurl/c/CURLOPT_POSTFIELDSIZE_LARGE.html
1 parent f6fe838 commit 6c3ba33

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ext/curl/interface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,15 +2170,15 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
21702170
/* no need to build the mime structure for empty hashtables;
21712171
also works around https://github.com/curl/curl/issues/6455 */
21722172
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
2173-
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0L);
2173+
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, 0L);
21742174
} else {
21752175
return build_mime_structure_from_hash(ch, zvalue);
21762176
}
21772177
} else {
21782178
zend_string *tmp_str;
21792179
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
21802180
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
2181-
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
2181+
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, ZSTR_LEN(str));
21822182
error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, ZSTR_VAL(str));
21832183
zend_tmp_string_release(tmp_str);
21842184
}

0 commit comments

Comments
 (0)