Fix #79013: Content-Length missing when posting a curlFile with curl#5219
Closed
cmb69 wants to merge 1 commit intophp:PHP-7.4from
Closed
Fix #79013: Content-Length missing when posting a curlFile with curl#5219cmb69 wants to merge 1 commit intophp:PHP-7.4from
cmb69 wants to merge 1 commit intophp:PHP-7.4from
Conversation
Unfortunately, some Webservers (e.g. IIS) do not implement the (F)CGI specifications correctly wrt. chunked uploads (i.e. Transfer-encoding: chunked), but instead pass `-1` as CONTENT_LENGTH to the CGI application. However, our (F)CFI SAPIs (i.e. cgi and cgi-fcgi) do not support this. Therefore we do no longer do chunked uploads unless ext/curl has been compiled with `CURL_FILE_AS_STREAM` for best interoperability. We only make minimal modifications to the code for simplicity, and also because we consider this commit a mere work-around for broken (F)CGI servers/ applications which have to deal with HTTP/1.1 requests (HTTP/2 and later do no longer support Transfer-encoding: chunked, anyway). Users who are sure that they upload CURLFiles to servers which support chunked uploads are encouraged to build with `CURL_FILE_AS_STREAM`; we introduce the PHP constant `CURL_FILE_AS_STREAM` to be able to retrieve this information during run-time.
Member
Author
|
I would like to get this into PHP 7.4.4, so the PR would have to be merged on Monday. Any objections? Anyway, review would be appreciated! |
Member
Author
|
Closing in favor of PR #5228. |
Contributor
|
@cmb69 do you know a userland work around for this? It seems some distros does not have it (7.4.3 and 7.68.0 f.e.). Facing this exact issue right now :) |
Member
Author
|
@pierrejoye sorry, I don't think there's a simple workaround; likely you'd have to construct the full payload manually. :( |
Contributor
|
Thanks :)
Did the lazy way and switch to the wonderful Ondrej's repository :)
…On Tue, Aug 18, 2020, 3:40 PM Christoph M. Becker ***@***.***> wrote:
@pierrejoye <https://github.com/pierrejoye> sorry, I don't think there's
a simple workaround; likely you'd have to construct the full payload
manually. :(
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5219 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACE6KH4HWJ7EJY44IA7GO3SBI47LANCNFSM4K5NET6Q>
.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unfortunately, some Webservers (e.g. IIS) do not implement the (F)CGI
specifications correctly wrt. chunked uploads (i.e. Transfer-encoding:
chunked), but instead pass
-1as CONTENT_LENGTH to the CGIapplication. However, our (F)CFI SAPIs (i.e. cgi and cgi-fcgi) do not
support this.
Therefore we do no longer do chunked uploads unless ext/curl has been
compiled with
CURL_FILE_AS_STREAMfor best interoperability. We onlymake minimal modifications to the code for simplicity, and also because
we consider this commit a mere work-around for broken (F)CGI servers/
applications which have to deal with HTTP/1.1 requests (HTTP/2 and
later do no longer support Transfer-encoding: chunked, anyway).
Users who are sure that they upload CURLFiles to servers which support
chunked uploads are encouraged to build with
CURL_FILE_AS_STREAM; weintroduce the PHP constant
CURL_FILE_AS_STREAMto be able to retrievethis information during run-time.