Skip to content

Commit 06aaf22

Browse files
feature #32807 [HttpClient] add "max_duration" option (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] add "max_duration" option | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#32765 | License | MIT | Doc PR | symfony/symfony-docs#12073 Commits ------- a4178f1369 [HttpClient] add "max_duration" option
2 parents 433f060 + f178c79 commit 06aaf22

File tree

6 files changed

+11
-0
lines changed

6 files changed

+11
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,9 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
13671367
->floatNode('timeout')
13681368
->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
13691369
->end()
1370+
->floatNode('max_duration')
1371+
->info('The maximum execution time for the request+response as a whole.')
1372+
->end()
13701373
->scalarNode('bindto')
13711374
->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')
13721375
->end()
@@ -1503,6 +1506,9 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
15031506
->floatNode('timeout')
15041507
->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
15051508
->end()
1509+
->floatNode('max_duration')
1510+
->info('The maximum execution time for the request+response as a whole.')
1511+
->end()
15061512
->scalarNode('bindto')
15071513
->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')
15081514
->end()

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@
495495
<xsd:attribute name="proxy" type="xsd:string" />
496496
<xsd:attribute name="no-proxy" type="xsd:string" />
497497
<xsd:attribute name="timeout" type="xsd:float" />
498+
<xsd:attribute name="max-duration" type="xsd:float" />
498499
<xsd:attribute name="bindto" type="xsd:string" />
499500
<xsd:attribute name="verify-peer" type="xsd:boolean" />
500501
<xsd:attribute name="verify-host" type="xsd:boolean" />

Tests/DependencyInjection/Fixtures/php/http_client_full_default_options.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'resolve' => ['localhost' => '127.0.0.1'],
1010
'proxy' => 'proxy.org',
1111
'timeout' => 3.5,
12+
'max_duration' => 10.1,
1213
'bindto' => '127.0.0.1',
1314
'verify_peer' => true,
1415
'verify_host' => true,

Tests/DependencyInjection/Fixtures/xml/http_client_full_default_options.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
proxy="proxy.org"
1212
bindto="127.0.0.1"
1313
timeout="3.5"
14+
max-duration="10.1"
1415
verify-peer="true"
1516
max-redirects="2"
1617
http-version="2.0"

Tests/DependencyInjection/Fixtures/yml/http_client_full_default_options.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ framework:
88
resolve: {'localhost': '127.0.0.1'}
99
proxy: proxy.org
1010
timeout: 3.5
11+
max_duration: 10.1
1112
bindto: 127.0.0.1
1213
verify_peer: true
1314
verify_host: true

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,7 @@ public function testHttpClientFullDefaultOptions()
15471547
$this->assertSame(['localhost' => '127.0.0.1'], $defaultOptions['resolve']);
15481548
$this->assertSame('proxy.org', $defaultOptions['proxy']);
15491549
$this->assertSame(3.5, $defaultOptions['timeout']);
1550+
$this->assertSame(10.1, $defaultOptions['max_duration']);
15501551
$this->assertSame('127.0.0.1', $defaultOptions['bindto']);
15511552
$this->assertTrue($defaultOptions['verify_peer']);
15521553
$this->assertTrue($defaultOptions['verify_host']);

0 commit comments

Comments
 (0)