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 dc71298

Browse filesBrowse files
[HttpClient] Fix uploading files > 2GB
1 parent 0549c6f commit dc71298
Copy full SHA for dc71298

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.