From e289723aadab0abaa96435a9cd77f000086cf1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 7 Aug 2019 19:03:18 +0200 Subject: [PATCH] [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt --- src/Symfony/Component/HttpClient/CurlHttpClient.php | 2 +- .../Contracts/HttpClient/Test/HttpClientTestCase.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 204bcd8b93..75e7d5e922 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -140,7 +140,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0, CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects - CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'], + CURLOPT_TIMEOUT => 0, CURLOPT_PROXY => $options['proxy'], CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '', CURLOPT_SSL_VERIFYPEER => $options['verify_peer'], diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php index ea5ef2187c..d13b192c5b 100644 --- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php +++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php @@ -583,6 +583,16 @@ abstract class HttpClientTestCase extends TestCase $client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]); } + public function testNotATimeout() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-header', [ + 'timeout' => 0.5, + ]); + usleep(510000); + $this->assertSame(200, $response->getStatusCode()); + } + public function testTimeoutOnAccess() { $client = $this->getHttpClient(__FUNCTION__);