[HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt

This commit is contained in:
Grégoire Pineau 2019-08-07 19:03:18 +02:00 committed by Nicolas Grekas
parent f3f6b584e4
commit e289723aad
2 changed files with 11 additions and 1 deletions

View File

@ -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'],

View File

@ -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__);