[HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt
This commit is contained in:
parent
f3f6b584e4
commit
e289723aad
@ -140,7 +140,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
|
|||||||
CURLOPT_FOLLOWLOCATION => true,
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
|
CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
|
||||||
CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
|
CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
|
||||||
CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'],
|
CURLOPT_TIMEOUT => 0,
|
||||||
CURLOPT_PROXY => $options['proxy'],
|
CURLOPT_PROXY => $options['proxy'],
|
||||||
CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
|
CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
|
||||||
CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],
|
CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],
|
||||||
|
@ -583,6 +583,16 @@ abstract class HttpClientTestCase extends TestCase
|
|||||||
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]);
|
$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()
|
public function testTimeoutOnAccess()
|
||||||
{
|
{
|
||||||
$client = $this->getHttpClient(__FUNCTION__);
|
$client = $this->getHttpClient(__FUNCTION__);
|
||||||
|
Reference in New Issue
Block a user