8000 [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt · fabpot/symfony@e289723 · GitHub
[go: up one dir, main page]

Skip to content

Commit e289723

Browse files
lyrixxnicolas-grekas
authored andcommitted
[HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt
1 parent f3f6b58 commit e289723

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function request(string $method, string $url, array $options = []): Respo
140140
CURLOPT_FOLLOWLOCATION => true,
141141
CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
142142
CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
143-
CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'],
143+
CURLOPT_TIMEOUT => 0,
144144
CURLOPT_PROXY => $options['proxy'],
145145
CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
146146
CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,16 @@ public function testResolve()
583583
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]);
584584
}
585585

586+
public function testNotATimeout()
587+
{
588+
$client = $this->getHttpClient(__FUNCTION__);
589+
$response = $client->request('GET', 'http://localhost:8057/timeout-header', [
590+
'timeout' => 0.5,
591+
]);
592+
usleep(510000);
593+
$this->assertSame(200, $response->getStatusCode());
594+
}
595+
586596
public function testTimeoutOnAccess()
587597
{
588598
$client = $this->getHttpClient(__FUNCTION__);

0 commit comments

Comments
 (0)
0