From fd9711d9495e4ddcd41eda7a284dfc7f37c11f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 4 Jan 2024 15:15:41 +0100 Subject: Rework and improve the decompress stream handler The read buffer was changed into an iovec to avoid doing too many binary concatenations and allocations. Decompression happens transparently: when decoding gzip, the content-encoding header is removed (we only decode when "gzip" is the only encoding so nothing remains). We always add a content_decoded key to the Req object. This key contains a list of codings that were decoded, in the reverse order in which they were. Currently it can only be empty or contain <<"gzip">> but future improvements or user handlers may see it contain more values. The option to disable decompression was renamed to decompress_enabled and defaults to true. It is no longer possible to enable/disable decompression in the middle of reading the body: this ensures that the data we pass forward is always valid. Various smaller improvements were made to the code, tests and manual pages. --- doc/src/guide/streams.asciidoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/src/guide/streams.asciidoc') diff --git a/doc/src/guide/streams.asciidoc b/doc/src/guide/streams.asciidoc index b6e4d34..e8ddae0 100644 --- a/doc/src/guide/streams.asciidoc +++ b/doc/src/guide/streams.asciidoc @@ -66,9 +66,9 @@ enabled by default. It is a good example for writing your own handlers that will modify responses. link:man:cowboy_decompress_h(3)[cowboy_decompress_h] will -automatically decompress requests when possible. It is not -enabled by default. It is a good example for writing your -own handlers that will modify requests. +automatically decompress request bodies when possible. +It is not enabled by default. It is a good example for +writing your own handlers that will modify requests. link:man:cowboy_metrics_h(3)[cowboy_metrics_h] gathers metrics about a stream then passes them to a configurable -- cgit v1.2.3