mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Cookie names are case sensitive
This should be more in line with what browsers are doing, and will prevent errors due to failed expectations.
This commit is contained in:
parent
a2f4703e5e
commit
61b3157ad1
1 changed files with 5 additions and 6 deletions
|
@ -157,8 +157,7 @@ cookie_name(Data = << C, _Rest/binary >>, Fun, Acc)
|
||||||
C =:= $\r; C =:= $\n; C =:= $\013; C =:= $\014 ->
|
C =:= $\r; C =:= $\n; C =:= $\013; C =:= $\014 ->
|
||||||
Fun(Data, Acc);
|
Fun(Data, Acc);
|
||||||
cookie_name(<< C, Rest/binary >>, Fun, Acc) ->
|
cookie_name(<< C, Rest/binary >>, Fun, Acc) ->
|
||||||
C2 = cowboy_bstr:char_to_lower(C),
|
cookie_name(Rest, Fun, << Acc/binary, C >>).
|
||||||
cookie_name(Rest, Fun, << Acc/binary, C2 >>).
|
|
||||||
|
|
||||||
-spec cookie_value(binary(), fun()) -> any().
|
-spec cookie_value(binary(), fun()) -> any().
|
||||||
cookie_value(Data, Fun) ->
|
cookie_value(Data, Fun) ->
|
||||||
|
@ -1110,14 +1109,14 @@ cookie_list_test_() ->
|
||||||
{<<"name2">>, <<"value2">>}
|
{<<"name2">>, <<"value2">>}
|
||||||
]},
|
]},
|
||||||
{<<"$Version=1; Customer=WILE_E_COYOTE; $Path=/acme">>, [
|
{<<"$Version=1; Customer=WILE_E_COYOTE; $Path=/acme">>, [
|
||||||
{<<"customer">>, <<"WILE_E_COYOTE">>}
|
{<<"Customer">>, <<"WILE_E_COYOTE">>}
|
||||||
]},
|
]},
|
||||||
{<<"$Version=1; Customer=WILE_E_COYOTE; $Path=/acme; "
|
{<<"$Version=1; Customer=WILE_E_COYOTE; $Path=/acme; "
|
||||||
"Part_Number=Rocket_Launcher_0001; $Path=/acme; "
|
"Part_Number=Rocket_Launcher_0001; $Path=/acme; "
|
||||||
"Shipping=FedEx; $Path=/acme">>, [
|
"Shipping=FedEx; $Path=/acme">>, [
|
||||||
{<<"customer">>, <<"WILE_E_COYOTE">>},
|
{<<"Customer">>, <<"WILE_E_COYOTE">>},
|
||||||
{<<"part_number">>, <<"Rocket_Launcher_0001">>},
|
{<<"Part_Number">>, <<"Rocket_Launcher_0001">>},
|
||||||
{<<"shipping">>, <<"FedEx">>}
|
{<<"Shipping">>, <<"FedEx">>}
|
||||||
]},
|
]},
|
||||||
%% Potential edge cases (initially from Mochiweb).
|
%% Potential edge cases (initially from Mochiweb).
|
||||||
{<<"foo=\\x">>, [{<<"foo">>, <<"\\x">>}]},
|
{<<"foo=\\x">>, [{<<"foo">>, <<"\\x">>}]},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue