Skip to content

Commit 5857093

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Expanding on HTTP compression
2 parents 1e071d5 + 3d89933 commit 5857093

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
@@ -379,11 +379,6 @@ immediately instead of waiting to receive the response::
379379
This component also supports :ref:`streaming responses <http-client-streaming-responses>`
380380
for full asynchronous applications.
381381

382-
.. note::
383-
384-
HTTP compression and chunked transfer encoding are automatically enabled when
385-
both your PHP runtime and the remote server support them.
386-
387382
Authentication
388383
~~~~~~~~~~~~~~
389384

@@ -899,6 +894,20 @@ Add an ``extra.curl`` option in your configuration to pass those extra options::
899894
Some cURL options are impossible to override (e.g. because of thread safety)
900895
and you'll get an exception when trying to override them.
901896

897+
HTTP Compression
898+
~~~~~~~~~~~~~~~~
899+
900+
The HTTP header ``Accept-Encoding: gzip`` is added automatically if:
901+
902+
* When using cURL client: cURL was compiled with ZLib support (see ``php --ri curl``)
903+
* When using the native HTTP client: `Zlib PHP extension`_ is installed
904+
905+
If the server does respond with a gzipped response, it's decoded transparently.
906+
To disable HTTP compression, send an ``Accept-Encoding: identity`` HTTP header.
907+
908+
Chunked transfer encoding is enabled automatically if both your PHP runtime and
909+
the remote server supports it.
910+
902911
HTTP/2 Support
903912
~~~~~~~~~~~~~~
904913

@@ -1970,6 +1979,7 @@ test it in a real application::
19701979
}
19711980

19721981
.. _`cURL PHP extension`: https://www.php.net/curl
1982+
.. _`Zlib PHP extension`: https://www.php.net/zlib
19731983
.. _`PSR-17`: https://www.php-fig.org/psr/psr-17/
19741984
.. _`PSR-18`: https://www.php-fig.org/psr/psr-18/
19751985
.. _`HTTPlug`: https://github.com/php-http/httplug/#readme

0 commit comments

Comments
 (0)