You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #45814 the HTTP-Client was changed to only set the content-length via the CURLOPT_INFILE option. However, that option is not used for CURLOPT_READFUNCTION. For that we would need CURLOPT_POSTFIELDSIZE which is not exposed in PHP (see php/php-src#8165).
As a result, when using a callback for the request's body, we cannot set the Content-Length header anymore.
In combination with resetting the Transfer-Encoding header to get curl to not send a chunked request, we cannot send a request with a body.
… body (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpClient] Fix sending content-length when streaming the body
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#45965
| License | MIT
| Doc PR | -
Follows #45906 and previous PRs on the topic.
This PR partly reverts previous changes but keeps tests added to cover how we manage content-related headers when redirecting.
Relying on curl doesn't work in all cases, so we need to manage them on our own.
Commits
-------
ee57696 [HttpClient] Fix sending content-length when streaming the body
Symfony version(s) affected
5.4.7
Description
In #45814 the HTTP-Client was changed to only set the content-length via the
CURLOPT_INFILE
option. However, that option is not used forCURLOPT_READFUNCTION
. For that we would needCURLOPT_POSTFIELDSIZE
which is not exposed in PHP (see php/php-src#8165).As a result, when using a callback for the request's body, we cannot set the Content-Length header anymore.
In combination with resetting the Transfer-Encoding header to get curl to not send a chunked request, we cannot send a request with a body.
How to reproduce
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: