Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b14777

Browse filesBrowse files
bug #59654 [HttpClient] Fix uploading files > 2GB (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [HttpClient] Fix uploading files > 2GB | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT See: - https://curl.se/libcurl/c/CURLOPT_INFILESIZE.html - https://github.com/curl/curl/blob/b13e9066b3dfd65ba8aadc336232ae7832ac687a/include/curl/curl.h#L1541 - https://www.php.net/manual/en/curl.constants.php#constant.curlopt-infile Commits ------- dc71298 [HttpClient] Fix uploading files > 2GB
2 parents 819e3e8 + dc71298 commit 1b14777
Copy full SHA for 1b14777

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎src/Symfony/Component/HttpClient/CurlHttpClient.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/CurlHttpClient.php
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function request(string $method, string $url, array $options = []): Respo
237237

238238
if (!\is_string($body)) {
239239
if (\is_resource($body)) {
240-
$curlopts[\CURLOPT_INFILE] = $body;
240+
$curlopts[\CURLOPT_READDATA] = $body;
241241
} else {
242242
$curlopts[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) {
243243
static $eof = false;
@@ -316,6 +316,9 @@ public function request(string $method, string $url, array $options = []): Respo
316316
}
317317

318318
foreach ($curlopts as $opt => $value) {
319+
if (\CURLOPT_INFILESIZE === $opt && $value >= 1 << 31) {
320+
$opt = 115; // 115 === CURLOPT_INFILESIZE_LARGE, but it's not defined in PHP
321+
}
319322
if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt && (!\defined('CURLOPT_HEADEROPT') || \CURLOPT_HEADEROPT !== $opt)) {
320323
$constantName = $this->findConstantName($opt);
321324
throw new TransportException(sprintf('Curl option "%s" is not supported.', $constantName ?? $opt));
@@ -472,7 +475,7 @@ private function validateExtraCurlOptions(array $options): void
472475
\CURLOPT_RESOLVE => 'resolve',
473476
\CURLOPT_NOSIGNAL => 'timeout',
474477
\CURLOPT_HTTPHEADER => 'headers',
475-
\CURLOPT_INFILE => 'body',
478+
\CURLOPT_READDATA => 'body',
476479
\CURLOPT_READFUNCTION => 'body',
477480
\CURLOPT_INFILESIZE => 'body',
478481
\CURLOPT_POSTFIELDS => 'body',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.