Skip to content

Commit 5823947

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Expanding on HTTP compression
2 parents 626bb8c + 5857093 commit 5823947

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

378-
.. note::
379-
380-
HTTP compression and chunked transfer encoding are automatically enabled when
381-
both your PHP runtime and the remote server support them.
382-
383378
Authentication
384379
~~~~~~~~~~~~~~
385380

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

873+
HTTP Compression
874+
~~~~~~~~~~~~~~~~
875+
876+
The HTTP header ``Accept-Encoding: gzip`` is added automatically if:
877+
878+
* When using cURL client: cURL was compiled with ZLib support (see ``php --ri curl``)
879+
* When using the native HTTP client: `Zlib PHP extension`_ is installed
880+
881+
If the server does respond with a gzipped response, it's decoded transparently.
882+
To disable HTTP compression, send an ``Accept-Encoding: identity`` HTTP header.
883+
884+
Chunked transfer encoding is enabled automatically if both your PHP runtime and
885+
the remote server supports it.
886+
878887
HTTP/2 Support
879888
~~~~~~~~~~~~~~
880889

@@ -1919,6 +1928,7 @@ test it in a real application::
19191928
}
19201929

19211930
.. _`cURL PHP extension`: https://www.php.net/curl
1931+
.. _`Zlib PHP extension`: https://www.php.net/zlib
19221932
.. _`PSR-17`: https://www.php-fig.org/psr/psr-17/
19231933
.. _`PSR-18`: https://www.php-fig.org/psr/psr-18/
19241934
.. _`HTTPlug`: https://github.com/php-http/httplug/#readme

0 commit comments

Comments
 (0)