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

Fix cowboy_req:filter_cookies missing valid cookies

When 3 or more cookies were sent the extra cookies were not
found because the binary:split on ";" stopped at the first
occurrence.
This commit is contained in:
Mirjam Friesen 2024-04-02 13:33:35 +02:00 committed by Loïc Hoguin
parent 8e121d138c
commit 36f42a5e8b
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 2 additions and 2 deletions

View file

@ -462,7 +462,7 @@ filter_cookies(Names0, Req=#{headers := Headers}) ->
case header(<<"cookie">>, Req) of
undefined -> Req;
Value0 ->
Cookies0 = binary:split(Value0, <<$;>>),
Cookies0 = binary:split(Value0, <<$;>>, [global]),
Cookies = lists:filter(fun(Cookie) ->
lists:member(cookie_name(Cookie), Names)
end, Cookies0),