Skip to content

Commit 2802fe6

Browse files
Expanding on HTTP compression
I moved the note downwards, because two things should be explained before it: * cURL and Native Client * How to send an HTTP header Besides, it not that important to have it explained right on top; and it fits nicely in the "Performance" section. The info is taken from symfony#17216 (comment)
1 parent 32949b5 commit 2802fe6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

http_client.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,6 @@ immediately instead of waiting to receive the response::
373373
This component also supports :ref:`streaming responses <http-client-streaming-responses>`
374374
for full asynchronous applications.
375375

376-
.. note::
377-
378-
HTTP compression and chunked transfer encoding are automatically enabled when
379-
both your PHP runtime and the remote server support them.
380-
381376
Authentication
382377
~~~~~~~~~~~~~~
383378

@@ -758,6 +753,20 @@ When using this component in a full-stack Symfony application, this behavior is
758753
not configurable and cURL will be used automatically if the cURL PHP extension
759754
is installed and enabled. Otherwise, the native PHP streams will be used.
760755

756+
HTTP Compression
757+
~~~~~~~~~~~~~~~~
758+
759+
A HTTP header ``Accept-Encoding: gzip`` is added automatically if ...
760+
761+
* cURL Client: ... cURL was compiled with ZLib support (see ``php --ri curl``)
762+
* Native Http Client: ... `Zlib PHP extension`_ is installed
763+
764+
If the server does respond with a gzipped response, it's decoded transparently.
765+
766+
To disable HTTP compression, send an ``Accept-Encoding: identity`` HTTP header.
767+
768+
Chunked transfer encoding is enabled automatically if both your PHP runtime and the remote server supports it.
769+
761770
HTTP/2 Support
762771
~~~~~~~~~~~~~~
763772

@@ -1571,6 +1580,7 @@ test it in a real application::
15711580
}
15721581

15731582
.. _`cURL PHP extension`: https://www.php.net/curl
1583+
.. _`Zlib PHP extension`: https://www.php.net/zlib
15741584
.. _`PSR-17`: https://www.php-fig.org/psr/psr-17/
15751585
.. _`PSR-18`: https://www.php-fig.org/psr/psr-18/
15761586
.. _`HTTPlug`: https://github.com/php-http/httplug/#readme

0 commit comments

Comments
 (0)