aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_compress_h.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-18 23:03:30 +0100
committerLoïc Hoguin <[email protected]>2018-11-18 23:03:30 +0100
commit6cc3b0ccca6c06592c2a1881cae39945de805747 (patch)
treec01e57a9ee88a524a2ca6b43b13f831bd96e009e /doc/src/manual/cowboy_compress_h.asciidoc
parent8d6d78575f64055be2d0992d8ccf802d9efa1faa (diff)
downloadcowboy-6cc3b0ccca6c06592c2a1881cae39945de805747.tar.gz
cowboy-6cc3b0ccca6c06592c2a1881cae39945de805747.tar.bz2
cowboy-6cc3b0ccca6c06592c2a1881cae39945de805747.zip
Document cowboy_stream_h/cowboy_compress_h
Diffstat (limited to 'doc/src/manual/cowboy_compress_h.asciidoc')
-rw-r--r--doc/src/manual/cowboy_compress_h.asciidoc60
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_compress_h.asciidoc b/doc/src/manual/cowboy_compress_h.asciidoc
new file mode 100644
index 0000000..ee39cae
--- /dev/null
+++ b/doc/src/manual/cowboy_compress_h.asciidoc
@@ -0,0 +1,60 @@
+= cowboy_compress_h(3)
+
+== Name
+
+cowboy_compress_h - Compress stream handler
+
+== Description
+
+The module `cowboy_compress_h` compresses response bodies
+automatically when the client supports it. It will not
+try to compress responses that already have a content
+encoding.
+
+Normal responses will only be compressed when their
+size is lower than the configured threshold. Streamed
+responses are always compressed, including when the
+sendfile command is used. Because the file must be
+read in memory to be compressed, this module is *not*
+suitable for automatically compressing large files.
+
+== Options
+
+[source,erlang]
+----
+opts() :: #{
+ compress_buffering => boolean(),
+ compress_threshold => non_neg_integer()
+}
+----
+
+Configuration for the default stream handler.
+
+The default value is given next to the option name:
+
+compress_buffering (false)::
+
+Whether the output will be buffered. By default no
+buffering is done to provide maximum compatibility
+at the cost of a lower compression rate.
+
+compress_threshold (300)::
+
+How large the response body must be to be compressed
+when the response isn't streamed.
+
+== Events
+
+The compress stream handler does not produce any event.
+
+== Changelog
+
+* *2.6*: The options `compress_buffering` and
+ `compress_threshold` were added.
+* *2.0*: Module introduced.
+
+== See also
+
+link:man:cowboy(7)[cowboy(7)],
+link:man:cowboy_stream(3)[cowboy_stream(3)],
+link:man:cowboy_stream_h(3)[cowboy_stream_h(3)]