Skip to content
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

[HttpClient] Fix uploading files > 2GB #59654

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jan 30, 2025

@@ -316,6 +316,9 @@ public function request(string $method, string $url, array $options = []): Respo
}

foreach ($curlopts as $opt => $value) {
if (\CURLOPT_INFILESIZE === $opt && $value >= 1 << 31) {
$opt = 115; // 115 === CURLOPT_INFILESIZE_LARGE, but it's not defined in PHP
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity: Can we add this constant in php-src/ext-curl? I checked the code there, but I can only find CURLOPT_INFILESIZE, so it may mainly be a copy paste. The problem is, that I did not find the definition for CURLOPT_INIFILESIZE to be 14 to be able to add 115 for the new constant 🤔 Any hints?

Copy link
Member Author

Choose a reason for hiding this comment

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

See https://github.com/curl/curl/blob/b13e9066b3dfd65ba8aadc336232ae7832ac687a/include/curl/curl.h#L1541

php-src could add the const for sure, but that won't solve the issue for us since this would be for PHP 8.5 earlier.

Copy link
Contributor

Choose a reason for hiding this comment

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

but that won't solve the issue for us since this would be for PHP 8.5 earlier.

that's cristal clear, I know 👍

Copy link
Member

Choose a reason for hiding this comment

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

"A few moments later"
image

@nicolas-grekas nicolas-grekas merged commit 1b14777 into symfony:6.4 Feb 4, 2025
7 of 11 checks passed
@nicolas-grekas nicolas-grekas deleted the hc-large-upload branch February 4, 2025 14:30
nicolas-grekas added a commit that referenced this pull request Feb 4, 2025
…ported (xabbuh)

This PR was merged into the 6.4 branch.

Discussion
----------

[HttpClient] pass CURLOPT_INFILESIZE_LARGE only when supported

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

following #59654

Commits
-------

018a384 pass CURLOPT_INFILESIZE_LARGE only when supported
This was referenced Feb 26, 2025
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.

4 participants