Description
Symfony version(s) affected: 4.3.x
Description
Symfony's HTTP CURL Client supports a timeout
option that will set the option CURLOPT_CONNECTTIMEOUT_MS
of curl. This parameter only configures the timeout for the connect phase.
But in some use cases (like a crawler f.e) we need to limit the maximum time a request is allowed to take, not only the connect duration. This is what the curl options CURLOPT_TIMEOUT
and CURLOPT_TIMEOUT_MS
do.
Unless I'm wrong, there is no way to configure the curl client with some custom config. Is that really intended? If yes, how can we change this timeout behavior?
How to reproduce
$httpClient = new CurlHttpClient();
$httpClient->request('GET', 'http://example.com/a-page-that-takes-a-long-time-to-render', [
'timeout' => 1,
]);
Possible Solution
Either add a way to override curl option or change the timeout behavior of the curl client