aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Strollo <[email protected]>2021-11-15 16:42:28 +0100
committerLoïc Hoguin <[email protected]>2022-09-12 11:08:17 +0200
commit7ceed650df638775e09bc032910fc8f527b32945 (patch)
tree97d0d6fd0555dc761add23b5558176118f1f0df5
parent3475c803d0b39296da953c084b1a804c56c41547 (diff)
downloadcowlib-7ceed650df638775e09bc032910fc8f527b32945.tar.gz
cowlib-7ceed650df638775e09bc032910fc8f527b32945.tar.bz2
cowlib-7ceed650df638775e09bc032910fc8f527b32945.zip
Remove the obsolete Version cookie attribute
-rw-r--r--src/cow_cookie.erl18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/cow_cookie.erl b/src/cow_cookie.erl
index 953cc25..28c93ff 100644
--- a/src/cow_cookie.erl
+++ b/src/cow_cookie.erl
@@ -351,7 +351,7 @@ setcookie(Name, Value, Opts) ->
<<$\s>>, <<$\t>>, <<$\r>>, <<$\n>>, <<$\013>>, <<$\014>>]),
nomatch = binary:match(iolist_to_binary(Value), [<<$,>>, <<$;>>,
<<$\s>>, <<$\t>>, <<$\r>>, <<$\n>>, <<$\013>>, <<$\014>>]),
- [Name, <<"=">>, Value, <<"; Version=1">>, attributes(maps:to_list(Opts))].
+ [Name, <<"=">>, Value, attributes(maps:to_list(Opts))].
attributes([]) -> [];
attributes([{domain, Domain}|Tail]) -> [<<"; Domain=">>, Domain|attributes(Tail)];
@@ -381,26 +381,26 @@ setcookie_test_() ->
Tests = [
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{http_only => true, domain => <<"acme.com">>},
- <<"Customer=WILE_E_COYOTE; Version=1; "
+ <<"Customer=WILE_E_COYOTE; "
"Domain=acme.com; HttpOnly">>},
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{path => <<"/acme">>},
- <<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>},
+ <<"Customer=WILE_E_COYOTE; Path=/acme">>},
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{secure => true},
- <<"Customer=WILE_E_COYOTE; Version=1; Secure">>},
+ <<"Customer=WILE_E_COYOTE; Secure">>},
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{secure => false, http_only => false},
- <<"Customer=WILE_E_COYOTE; Version=1">>},
+ <<"Customer=WILE_E_COYOTE">>},
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{same_site => lax},
- <<"Customer=WILE_E_COYOTE; Version=1; SameSite=Lax">>},
+ <<"Customer=WILE_E_COYOTE; SameSite=Lax">>},
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{same_site => strict},
- <<"Customer=WILE_E_COYOTE; Version=1; SameSite=Strict">>},
+ <<"Customer=WILE_E_COYOTE; SameSite=Strict">>},
{<<"Customer">>, <<"WILE_E_COYOTE">>,
#{path => <<"/acme">>, badoption => <<"negatory">>},
- <<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>}
+ <<"Customer=WILE_E_COYOTE; Path=/acme">>}
],
[{R, fun() -> R = iolist_to_binary(setcookie(N, V, O)) end}
|| {N, V, O, R} <- Tests].
@@ -411,7 +411,6 @@ setcookie_max_age_test() ->
setcookie(N, V, O)), <<";">>, [global])
end,
[<<"Customer=WILE_E_COYOTE">>,
- <<" Version=1">>,
<<" Expires=", _/binary>>,
<<" Max-Age=111">>,
<<" Secure">>] = F(<<"Customer">>, <<"WILE_E_COYOTE">>,
@@ -420,7 +419,6 @@ setcookie_max_age_test() ->
{'EXIT', {{badarg, {max_age, -111}}, _}} -> ok
end,
[<<"Customer=WILE_E_COYOTE">>,
- <<" Version=1">>,
<<" Expires=", _/binary>>,
<<" Max-Age=86417">>] = F(<<"Customer">>, <<"WILE_E_COYOTE">>,
#{max_age => 86417}),