aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-11-27 16:15:15 +0100
committerLoïc Hoguin <[email protected]>2012-11-27 16:15:15 +0100
commit5bc5f56eb2c6c49bd638484f8f36c0515746fecb (patch)
treed2a75439d0a3e12e42a98fab6eca2495a0a793b0
parent8386e10dcc9a4136717d728bb8c0918dc57d9f93 (diff)
downloadcowboy-5bc5f56eb2c6c49bd638484f8f36c0515746fecb.tar.gz
cowboy-5bc5f56eb2c6c49bd638484f8f36c0515746fecb.tar.bz2
cowboy-5bc5f56eb2c6c49bd638484f8f36c0515746fecb.zip
Do not try to keep-alive when using HTTP/1.0
-rw-r--r--src/cowboy_req.erl6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 3426dbc..2d45a59 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -183,15 +183,13 @@ new(Socket, Transport, Method, Path, Query, Fragment,
method=Method, path=Path, qs=Query, fragment=Fragment, version=Version,
headers=Headers, host=Host, port=Port, buffer=Buffer,
onresponse=OnResponse},
- case CanKeepalive of
+ case CanKeepalive and (Version =:= {1, 1}) of
false ->
Req#http_req{connection=close};
true ->
case lists:keyfind(<<"connection">>, 1, Headers) of
- false when Version =:= {1, 1} ->
- Req; %% keepalive
false ->
- Req#http_req{connection=close};
+ Req; %% keepalive
{_, ConnectionHeader} ->
Tokens = parse_connection_before(ConnectionHeader, []),
Connection = connection_to_atom(Tokens),