Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b18b659

Browse files
committed
[HttpClient] Frameworkbundle buffer option configuration
1 parent 09e9cab commit b18b659

File tree

6 files changed

+28
-0
lines changed

6 files changed

+28
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,13 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
13931393
->scalarNode('ciphers')
13941394
->info('A list of SSL/TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...)')
13951395
->end()
1396+
->scalarNode('buffer')
1397+
->info('Response content should be buffered or not')
1398+
->validate()
1399+
->ifTrue(function ($v) { return !\is_bool($v) && (\is_string($v) && false === @preg_match($v, '')); })
1400+
->thenInvalid('Buffer option should be a boolean or a valid regex')
1401+
->end()
1402+
->end()
13961403
->arrayNode('peer_fingerprint')
13971404
->info('Associative array: hashing algorithm => hash(es).')
13981405
->normalizeKeys(false)
@@ -1529,6 +1536,13 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
15291536
->scalarNode('ciphers')
15301537
->info('A list of SSL/TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...)')
15311538
->end()
1539+
->scalarNode('buffer')
1540+
->info('Response content should be buffered or not')
1541+
->validate()
1542+
->ifTrue(function ($v) { return !\is_bool($v) && (\is_string($v) && false === @preg_match($v, '')); })
1543+
->thenInvalid('Buffer option should be a boolean or a valid regex')
1544+
->end()
1545+
->end()
15321546
->arrayNode('peer_fingerprint')
15331547
->info('Associative array: hashing algorithm => hash(es).')
15341548
->normalizeKeys(false)

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,11 @@
503503
<xsd:attribute name="local-pk" type="xsd:string" />
504504
<xsd:attribute name="passphrase" type="xsd:string" />
505505
<xsd:attribute name="ciphers" type="xsd:string" />
506+
<xsd:attribute name="buffer">
507+
<xsd:simpleType>
508+
<xsd:union memberTypes="xsd:string xsd:boolean" />
509+
</xsd:simpleType>
510+
</xsd:attribute>
506511

507512
</xsd:complexType>
508513

@@ -532,6 +537,11 @@
532537
<xsd:attribute name="local-pk" type="xsd:string" />
533538
<xsd:attribute name="passphrase" type="xsd:string" />
534539
<xsd:attribute name="ciphers" type="xsd:string" />
540+
<xsd:attribute name="buffer">
541+
<xsd:simpleType>
542+
<xsd:union memberTypes="xsd:string xsd:boolean" />
543+
</xsd:simpleType>
544+
</xsd:attribute>
535545
</xsd:complexType>
536546

537547
<xsd:complexType name="fingerprint">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/http_client_full_default_options.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'local_pk' => '/etc/ssl/private_key.pem',
1919
'passphrase' => 'password123456',
2020
'ciphers' => 'RC4-SHA:TLS13-AES-128-GCM-SHA256',
21+
'buffer' => true,
2122
'peer_fingerprint' => [
2223
'pin-sha256' => ['14s5erg62v1v8471g2revg48r7==', 'jsda84hjtyd4821bgfesd215bsfg5412='],
2324
'md5' => 'sdhtb481248721thbr=',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/http_client_full_default_options.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
local-pk="/etc/ssl/private_key.pem"
2222
passphrase="password123456"
2323
ciphers="RC4-SHA:TLS13-AES-128-GCM-SHA256"
24+
buffer="true"
2425
>
2526
<framework:header name="X-powered">PHP</framework:header>
2627
<framework:resolve host="localhost">127.0.0.1</framework:resolve>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/http_client_full_default_options.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ framework:
1717
local_pk: /etc/ssl/private_key.pem
1818
passphrase: password123456
1919
ciphers: 'RC4-SHA:TLS13-AES-128-GCM-SHA256'
20+
buffer: true
2021
peer_fingerprint:
2122
pin-sha256: ['14s5erg62v1v8471g2revg48r7==', 'jsda84hjtyd4821bgfesd215bsfg5412=']
2223
md5: 'sdhtb481248721thbr='

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,7 @@ public function testHttpClientFullDefaultOptions()
15621562
$this->assertSame('/etc/ssl/private_key.pem', $defaultOptions['local_pk']);
15631563
$this->assertSame('password123456', $defaultOptions['passphrase']);
15641564
$this->assertSame('RC4-SHA:TLS13-AES-128-GCM-SHA256', $defaultOptions['ciphers']);
1565+
$this->assertTrue($defaultOptions['buffer']);
15651566
$this->assertSame([
15661567
'pin-sha256' => ['14s5erg62v1v8471g2revg48r7==', 'jsda84hjtyd4821bgfesd215bsfg5412='],
15671568
'md5' => 'sdhtb481248721thbr=',

0 commit comments

Comments
 (0)