Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 510c510

Browse filesBrowse files
Merge branch '5.4' into 6.3
* 5.4: [HttpClient] Fix pausing responses before they start when using curl separate child and parent context in NotificationEmail on writes do not overwrite the cache key when it is false [Mailer] Throw TransportException when unable to read from socket [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts [HttpClient] Fix error chunk creation in passthru Adjusting and removing the 'review' attribute from the pt_br translation XML. [Serializer] Take unnamed variadic parameters into account when denormalizing
2 parents 5b7fa7e + 53e4cc0 commit 510c510
Copy full SHA for 510c510

File tree

Expand file treeCollapse file tree

3 files changed

+32
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-2
lines changed

‎Response/AsyncResponse.php

Copy file name to clipboardExpand all lines: Response/AsyncResponse.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct(HttpClientInterface $client, string $method, string
6565
while (true) {
6666
foreach (self::stream([$response], $timeout) as $chunk) {
6767
if ($chunk->isTimeout() && $response->passthru) {
68-
foreach (self::passthru($response->client, $response, new ErrorChunk($response->offset, new TransportException($chunk->getError()))) as $chunk) {
68+
foreach (self::passthru($response->client, $response, new ErrorChunk($response->offset, $chunk->getError())) as $chunk) {
6969
if ($chunk->isFirst()) {
7070
return false;
7171
}

‎Response/CurlResponse.php

Copy file name to clipboardExpand all lines: Response/CurlResponse.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public function __construct(CurlClientState $multi, \CurlHandle|string $ch, ?arr
9898
$this->info['pause_handler'] = static function (float $duration) use ($ch, $multi, $execCounter) {
9999
if (0 < $duration) {
100100
if ($execCounter === $multi->execCounter) {
101-
$multi->execCounter = !\is_float($execCounter) ? 1 + $execCounter : \PHP_INT_MIN;
102101
curl_multi_remove_handle($multi->handle, $ch);
103102
}
104103

‎Tests/RetryableHttpClientTest.php

Copy file name to clipboardExpand all lines: Tests/RetryableHttpClientTest.php
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpClient\Exception\ServerException;
16+
use Symfony\Component\HttpClient\Exception\TimeoutException;
1617
use Symfony\Component\HttpClient\HttpClient;
1718
use Symfony\Component\HttpClient\MockHttpClient;
1819
use Symfony\Component\HttpClient\NativeHttpClient;
@@ -21,6 +22,7 @@
2122
use Symfony\Component\HttpClient\Retry\GenericRetryStrategy;
2223
use Symfony\Component\HttpClient\RetryableHttpClient;
2324
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
25+
use Symfony\Contracts\HttpClient\Test\TestHttpServer;
2426

2527
class RetryableHttpClientTest extends TestCase
2628
{
@@ -245,6 +247,35 @@ public function testRetryOnErrorAssertContent()
245247
self::assertSame('Test out content', $response->getContent(), 'Content should be buffered');
246248
}
247249

250+
/**
251+
* @testWith ["GET"]
252+
* ["POST"]
253+
* ["PUT"]
254+
* ["PATCH"]
255+
* ["DELETE"]
256+
*/
257+
public function testRetryOnHeaderTimeout(string $method)
258+
{
259+
$client = HttpClient::create();
260+
261+
if ($client instanceof NativeHttpClient) {
262+
$this->markTestSkipped('NativeHttpClient cannot timeout before receiving headers');
263+
}
264+
265+
TestHttpServer::start();
266+
267+
$client = new RetryableHttpClient($client);
268+
$response = $client->request($method, 'http://localhost:8057/timeout-header', ['timeout' => 0.1]);
269+
270+
try {
271+
$response->getStatusCode();
272+
$this->fail(TimeoutException::class.' expected');
273+
} catch (TimeoutException $e) {
274+
}
275+
276+
$this->assertSame('Idle timeout reached for "http://localhost:8057/timeout-header".', $response->getInfo('error'));
277+
}
278+
248279
public function testRetryWithMultipleBaseUris()
249280
{
250281
$client = new RetryableHttpClient(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.