8000 Merge branch '4.4' into 5.3 · symfony/http-client@6799916 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6799916

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: Bump license year [HttpClient] Turn negative timeout to a very long timeout Features goes to 6.x branch [Validator] throw when Constraint::_construct() has not been called Bump Symfony version to 4.4.37 Update VERSION for 4.4.36 Update CONTRIBUTORS for 4.4.36 Update CHANGELOG for 4.4.36 Allow symfony/runtime plugin
2 parents 6b47b47 + 09a4fef commit 6799916

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

HttpClientTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
159159

160160
// Finalize normalization of options
161161
$options['http_version'] = (string) ($options['http_version'] ?? '') ?: null;
162-
$options['timeout'] = (float) ($options['timeout'] ?? ini_get('default_socket_timeout'));
162+
if (0 > $options['timeout'] = (float) ($options['timeout'] ?? ini_get('default_socket_timeout'))) {
163+
$options['timeout'] = 172800.0; // 2 days
164+
}
165+
163166
$options['max_duration'] = isset($options['max_duration']) ? (float) $options['max_duration'] : 0;
164167

165168
return [$url, $options];

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018-2021 Fabien Potencier
1+
Copyright (c) 2018-2022 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Tests/HttpClientTestCase.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,13 @@ public function testDebugInfoOnDestruct()
373373

374374
$this->assertNotEmpty($traceInfo['debug']);
375375
}
376+
377+
public function testNegativeTimeout()
378+
{
379+
$client = $this->getHttpClient(__FUNCTION__);
380+
381+
$this->assertSame(200, $client->request('GET', 'http://localhost:8057', [
382+
'timeout' => -1,
383+
])->getStatusCode());
384+
}
376385
}

0 commit comments

Comments
 (0< 30A0 !-- -->)
0