diff options
author | Loïc Hoguin <[email protected]> | 2014-07-17 13:54:29 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-07-17 13:54:29 +0200 |
commit | 99061274b6dc602614a07a8751ea3925950f6b80 (patch) | |
tree | d911ecf2b32464ef67a12f02dec809300686dc42 /src | |
parent | 9980348a1cd74a41b3024f0b01d6fef301d8288b (diff) | |
parent | b10b34a8f204ed409a6fc936e199557bfe3b0975 (diff) | |
download | cowboy-99061274b6dc602614a07a8751ea3925950f6b80.tar.gz cowboy-99061274b6dc602614a07a8751ea3925950f6b80.tar.bz2 cowboy-99061274b6dc602614a07a8751ea3925950f6b80.zip |
Merge branch 'http-1-0-keepalive' of git://github.com/heroku/cowboy
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_req.erl | 7 |
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), |