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

Close the connection when the application sends Connection: close

Now Cowboy checks headers sent to the client for the 'Connection'
header value, parses it, and checks whether it contains a 'close'
or 'keep-alive' value. It makes sure to close or keep the connection
alive depending on the value found there, if any.

Also change chunked replies to not close the connection by default
unless the application requests it.
This commit is contained in:
Loïc Hoguin 2011-10-06 12:40:04 +02:00
parent 237b468f42
commit 8e835bce9f
2 changed files with 27 additions and 5 deletions

View file

@ -117,7 +117,7 @@ headers_dupe(Config) ->
{ok, Data} = gen_tcp:recv(Socket, 0, 6000),
{_Start, _Length} = binary:match(Data, <<"Connection: close">>),
nomatch = binary:match(Data, <<"Connection: keep-alive">>),
ok = gen_tcp:close(Socket).
{error, closed} = gen_tcp:recv(Socket, 0, 1000).
headers_huge(Config) ->
Cookie = lists:flatten(["whatever_man_biiiiiiiiiiiig_cookie_me_want_77="