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

Support curl_multi options #2329

Closed
darvids0n opened this issue Jul 8, 2019 · 1 comment
Closed

Support curl_multi options #2329

darvids0n opened this issue Jul 8, 2019 · 1 comment

Comments

@darvids0n
Copy link

Description
I'm using Guzzle to download many files in parallel using PSR-7 streams. At the moment we can construct a CurlMultiHandler which passes options to each handle via $options['curl']. However, passing options to the implicit multihandle resource $this->_mh is not supported, and is currently an implementation detail.

Example

$client = new \GuzzleHttp\Client();
$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
$options = [
    'curl' => [
        CURLOPT_TIMEOUT => 300,
    ],
    'curl_multi' => [
        CURLMOPT_MAX_HOST_CONNECTIONS => 4,
    ]
];
$promise = $client->sendAsync($request, $options)->then(function ($response) {
    echo 'I completed! ' . $response->getBody();
});

Additional context
Some of the config this would allow is already achievable using an EachPromise, but this feature request is more about the general functionality as well as future-proofing for any newly defined CURLMOPT options which may be useful to define in some edge cases.

@alexeyshockov
Copy link
Collaborator

Take a look at the related PR #2287, it adds curl_multi option to the client configuration level. It makes more sense to do it there, because multi options affect a bunch of requests, not only one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants