0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Handle properly the default Connection value for HTTP/1.0.

Fixes a bug reported by evaxsoftware on IRC.
This commit is contained in:
Loïc Hoguin 2011-04-05 20:07:52 +02:00
parent 04a5aa7c5c
commit 44e6f60b91

View file

@ -67,14 +67,16 @@ request({http_request, Method, {abs_path, AbsPath}, Version},
ConnAtom = version_to_connection(Version), ConnAtom = version_to_connection(Version),
wait_header(#http_req{socket=Socket, transport=Transport, wait_header(#http_req{socket=Socket, transport=Transport,
connection=ConnAtom, method=Method, version=Version, connection=ConnAtom, method=Method, version=Version,
path=Path, raw_path=RawPath, raw_qs=Qs}, State); path=Path, raw_path=RawPath, raw_qs=Qs},
State#state{connection=ConnAtom});
request({http_request, Method, '*', Version}, request({http_request, Method, '*', Version},
State=#state{socket=Socket, transport=Transport}) -> State=#state{socket=Socket, transport=Transport}) ->
{ok, Peer} = Transport:peername(Socket), {ok, Peer} = Transport:peername(Socket),
ConnAtom = version_to_connection(Version), ConnAtom = version_to_connection(Version),
wait_header(#http_req{socket=Socket, transport=Transport, wait_header(#http_req{socket=Socket, transport=Transport,
connection=ConnAtom, method=Method, version=Version, connection=ConnAtom, method=Method, version=Version,
peer=Peer, path='*', raw_path="*", raw_qs=[]}, State); peer=Peer, path='*', raw_path="*", raw_qs=[]},
State#state{connection=ConnAtom});
request({http_request, _Method, _URI, _Version}, State) -> request({http_request, _Method, _URI, _Version}, State) ->
error_terminate(501, State); error_terminate(501, State);
request({http_error, "\r\n"}, State) -> request({http_error, "\r\n"}, State) ->