From 905083a7fddcc7680405c504a646da9a70e3059e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 16 Sep 2012 23:54:29 +0200 Subject: Add the private set_connection/2 function used by cowboy_protocol --- src/cowboy_protocol.erl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/cowboy_protocol.erl') diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl index 8323b80..8ddd40d 100644 --- a/src/cowboy_protocol.erl +++ b/src/cowboy_protocol.erl @@ -199,15 +199,10 @@ header({http_header, _I, 'Host', _R, RawHost}, Req, %% Ignore Host headers if we already have it. header({http_header, _I, 'Host', _R, _V}, Req, State) -> parse_header(Req, State); -header({http_header, _I, 'Connection', _R, Connection}, - Req=#http_req{headers=Headers}, State=#state{ - req_keepalive=Keepalive, max_keepalive=MaxKeepalive}) +header({http_header, _I, 'Connection', _R, Connection}, Req, + State=#state{req_keepalive=Keepalive, max_keepalive=MaxKeepalive}) when Keepalive < MaxKeepalive -> - Req2 = Req#http_req{headers=[{'Connection', Connection}|Headers]}, - {ok, ConnTokens, Req3} - = cowboy_req:parse_header('Connection', Req2), - ConnAtom = cowboy_http:connection_to_atom(ConnTokens), - parse_header(Req3#http_req{connection=ConnAtom}, State); + parse_header(cowboy_req:set_connection(Connection, Req), State); header({http_header, _I, Field, _R, Value}, Req, State) -> Field2 = format_header(Field), parse_header(Req#http_req{headers=[{Field2, Value}|Req#http_req.headers]}, -- cgit v1.2.3