mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix cookie filter
This commit is contained in:
parent
8cb9d242b0
commit
6122aea7fd
2 changed files with 2 additions and 2 deletions
|
@ -462,7 +462,7 @@ filter_cookies(Names0, Req=#{headers := Headers}) ->
|
||||||
case header(<<"cookie">>, Req) of
|
case header(<<"cookie">>, Req) of
|
||||||
undefined -> Req;
|
undefined -> Req;
|
||||||
Value0 ->
|
Value0 ->
|
||||||
Cookies0 = binary:split(Value0, <<$;>>),
|
Cookies0 = binary:split(Value0, <<$;>>, [global]),
|
||||||
Cookies = lists:filter(fun(Cookie) ->
|
Cookies = lists:filter(fun(Cookie) ->
|
||||||
lists:member(cookie_name(Cookie), Names)
|
lists:member(cookie_name(Cookie), Names)
|
||||||
end, Cookies0),
|
end, Cookies0),
|
||||||
|
|
|
@ -324,7 +324,7 @@ filter_then_parse_cookies(Config) ->
|
||||||
[{<<"cookie">>, "bad name=strawberry"}], Config),
|
[{<<"cookie">>, "bad name=strawberry"}], Config),
|
||||||
<<"[{<<\"cake\">>,<<\"strawberry\">>}]">>
|
<<"[{<<\"cake\">>,<<\"strawberry\">>}]">>
|
||||||
= do_get_body("/filter_then_parse_cookies",
|
= do_get_body("/filter_then_parse_cookies",
|
||||||
[{<<"cookie">>, "bad name=strawberry; cake=strawberry"}], Config),
|
[{<<"cookie">>, "bad name=strawberry; another bad name=strawberry; cake=strawberry"}], Config),
|
||||||
<<"[]">>
|
<<"[]">>
|
||||||
= do_get_body("/filter_then_parse_cookies",
|
= do_get_body("/filter_then_parse_cookies",
|
||||||
[{<<"cookie">>, "Blocked by http://www.example.com/upgrade-to-remove"}], Config),
|
[{<<"cookie">>, "Blocked by http://www.example.com/upgrade-to-remove"}], Config),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue