From 09bf1199aa3e33a73970ee4ce38714be087b0df0 Mon Sep 17 00:00:00 2001 From: Steve Domin Date: Sat, 17 Feb 2018 16:43:46 +0300 Subject: 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. --- src/cowboy_http.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cowboy_http.erl') diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index 340ced7..91a539f 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -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]). -- cgit v1.2.3