From 983a07c1be405276a4992d9b421725194d70ae2b Mon Sep 17 00:00:00 2001 From: Michael Truog Date: Fri, 28 May 2021 23:29:25 -0700 Subject: [PATCH] Fix set-cookie response value check * Allow a single set-cookie binary as a response header value (assuming the value is a list occurs when it isn't a binary) --- src/cowboy_http.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index c9bceed8..31a5002f 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -1216,7 +1216,7 @@ commands(State, StreamID, [{push, _, _, _, _, _, _, _}|Tail]) -> commands(State, StreamID, Tail). %% The set-cookie header is special; we can only send one cookie per header. -headers_to_list(Headers0=#{<<"set-cookie">> := SetCookies}) -> +headers_to_list(Headers0=#{<<"set-cookie">> := SetCookies}) when not is_binary(SetCookies) -> Headers1 = maps:to_list(maps:remove(<<"set-cookie">>, Headers0)), Headers1 ++ [{<<"set-cookie">>, Value} || Value <- SetCookies]; headers_to_list(Headers) ->