[Website] Disable curl_share_init by default (to make Composer work) #2679
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.
Motivation for the change, related issues
Disables the
curl_share_initfunction in the default php.ini file on the web. Composer uses a "shared curl handle" to share DNS cache, cookies, TLS cache etc. between the handles as an optimization. Turns out, Playground TLS handler doesn't support shared handles at the moment. Using one triggers this PHP error on the second connection:For anyone in dire need of
curl_share_init, it can still be re-enabled by editing the php.ini file.Implementation details
In a perfect world, we'd adjust the TLS handler to support shared handlers. In practice, they don't seem to matter on the web. The TLS handler is only there to make PHP think it's talking to a server over an actual socket connection. All the requests are handled by
fetch()in the end andfetch()is already optimized. This PR, though, takes the shortcut and just disables thecurl_share_init()function to trigger this condition in CurlDownloader.php:Testing Instructions (or ideally a Blueprint)
Run this in devtools:
Confirm that, after a while, you can see an output similar to:
As a side note, it would be cool to call
playground.cli()and stream the output bytes, but we'll need a Comlink transfer handle for the StreamedResponse instance before we can do that.cc @mho22 @akirk