0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Add compress_threshold protocol option

Currently the compression threshold is set to 300 and hardcoded in the
codebase. There are cases where it make sense to allow this to be
configured, for instance when you want to enforce all responses to be
compressed regarldess of their size.
This commit is contained in:
Steve Domin 2018-02-17 16:43:46 +03:00 committed by Loïc Hoguin
parent 30e117a942
commit 09bf1199aa
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
4 changed files with 17 additions and 7 deletions

View file

@ -25,6 +25,7 @@
-export([system_code_change/4]).
-type opts() :: #{
compress_threshold => non_neg_integer(),
connection_type => worker | supervisor,
env => cowboy_middleware:env(),
idle_timeout => timeout(),
@ -46,7 +47,9 @@
shutdown_timeout => timeout(),
stream_handlers => [module()],
tracer_callback => cowboy_tracer_h:tracer_callback(),
tracer_match_specs => cowboy_tracer_h:tracer_match_specs()
tracer_match_specs => cowboy_tracer_h:tracer_match_specs(),
%% Open ended because configured stream handlers might add options.
_ => _
}.
-export_type([opts/0]).