diff options
author | Loïc Hoguin <[email protected]> | 2018-11-14 17:10:26 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-14 18:04:32 +0100 |
commit | 6f57405b5c775c4b3b60d0fde15c89e52cb91708 (patch) | |
tree | 75173c6aea32ddfed7fe756c49f0a20c1a1248bb /src | |
parent | f0cae8dbcf8d07035be069860fc4b22f7577d154 (diff) | |
download | cowboy-6f57405b5c775c4b3b60d0fde15c89e52cb91708.tar.gz cowboy-6f57405b5c775c4b3b60d0fde15c89e52cb91708.tar.bz2 cowboy-6f57405b5c775c4b3b60d0fde15c89e52cb91708.zip |
Allow disabling keep-alive for HTTP/1.0 connections
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_http.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index c4a4e79..caa4932 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -28,6 +28,7 @@ compress_threshold => non_neg_integer(), connection_type => worker | supervisor, env => cowboy_middleware:env(), + http10_keepalive => boolean(), idle_timeout => timeout(), inactivity_timeout => timeout(), linger_timeout => timeout(), @@ -1233,7 +1234,8 @@ stream_call_terminate(StreamID, Reason, StreamState, #state{opts=Opts}) -> Class, Exception, erlang:get_stacktrace()), Opts) end. -%% @todo max_reqs also +maybe_req_close(#state{opts=#{http10_keepalive := false}}, _, 'HTTP/1.0') -> + close; maybe_req_close(_, #{<<"connection">> := Conn}, 'HTTP/1.0') -> Conns = cow_http_hd:parse_connection(Conn), case lists:member(<<"keep-alive">>, Conns) of @@ -1247,7 +1249,7 @@ maybe_req_close(_, #{<<"connection">> := Conn}, 'HTTP/1.1') -> true -> close; false -> keepalive end; -maybe_req_close(_State, _, _) -> +maybe_req_close(_, _, _) -> keepalive. connection(State=#state{last_streamid=StreamID}, Headers=#{<<"connection">> := Conn}, StreamID, _) -> |