aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_req.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_req.erl')
-rw-r--r--src/cowboy_req.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 1394e72..981b321 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -174,13 +174,16 @@ new(Socket, Transport, Peer, Method, Path, Query,
method=Method, path=Path, qs=Query, version=Version,
headers=Headers, host=Host, port=Port, buffer=Buffer,
resp_compress=Compress, onresponse=OnResponse},
- case CanKeepalive and (Version =:= 'HTTP/1.1') of
+ case CanKeepalive of
false ->
Req#http_req{connection=close};
true ->
case lists:keyfind(<<"connection">>, 1, Headers) of
false ->
- Req; %% keepalive
+ case Version of
+ 'HTTP/1.1' -> Req; %% keepalive
+ 'HTTP/1.0' -> Req#http_req{connection=close}
+ end;
{_, ConnectionHeader} ->
Tokens = cow_http_hd:parse_connection(ConnectionHeader),
Connection = connection_to_atom(Tokens),