Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not try to keep-alive when using HTTP/1.0

  • Loading branch information...
commit 5bc5f56eb2c6c49bd638484f8f36c0515746fecb 1 parent 8386e10
@essen essen authored
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/cowboy_req.erl
View
6 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),
Please sign in to comment.
Something went wrong with that request. Please try again.