Skip to content

Commit fda49e6

Browse files
bug #33022 [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt (lyrixx)
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #33017 | License | MIT | Doc PR | - Commits ------- e289723 [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt
2 parents e8cd106 + e289723 commit fda49e6

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)