diff options
author | Loïc Hoguin <[email protected]> | 2018-12-31 18:01:19 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-12-31 18:03:27 +0100 |
commit | 228879bfc4eda8bac1919bab176c859c64ac54c2 (patch) | |
tree | 426ecb20acb366abcecc4d28c688449175ed53d6 /src | |
parent | 630bd475e6aa4b9fdde01272236d08305034cb48 (diff) | |
download | gun-228879bfc4eda8bac1919bab176c859c64ac54c2.tar.gz gun-228879bfc4eda8bac1919bab176c859c64ac54c2.tar.bz2 gun-228879bfc4eda8bac1919bab176c859c64ac54c2.zip |
Disable keepalive by default for HTTP/1.1
This is safer as servers may reject too many extra empty lines.
Diffstat (limited to 'src')
-rw-r--r-- | src/gun.erl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gun.erl b/src/gun.erl index 10ae2a7..f27e7f4 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -930,13 +930,12 @@ active(State=#state{socket=Socket, transport=Transport}) -> State. keepalive_timeout(State=#state{opts=Opts, protocol=Protocol}) -> - %% @todo Might not be worth checking every time? - ProtoOptsKey = case Protocol of - gun_http -> http_opts; - gun_http2 -> http2_opts + {ProtoOptsKey, Default} = case Protocol of + gun_http -> {http_opts, infinity}; + gun_http2 -> {http2_opts, 5000} end, ProtoOpts = maps:get(ProtoOptsKey, Opts, #{}), - Keepalive = maps:get(keepalive, ProtoOpts, 5000), + Keepalive = maps:get(keepalive, ProtoOpts, Default), KeepaliveRef = case Keepalive of infinity -> undefined; %% @todo Maybe change that to a start_timer. |