|
@@ -197,10 +197,12 @@ setcookie(Name, Value, Opts) ->
|
|
end,
|
|
end,
|
|
SecureBin = case lists:keyfind(secure, 1, Opts) of
|
|
SecureBin = case lists:keyfind(secure, 1, Opts) of
|
|
false -> <<>>;
|
|
false -> <<>>;
|
|
|
|
+ {_, false} -> <<>>;
|
|
{_, true} -> <<"; Secure">>
|
|
{_, true} -> <<"; Secure">>
|
|
end,
|
|
end,
|
|
HttpOnlyBin = case lists:keyfind(http_only, 1, Opts) of
|
|
HttpOnlyBin = case lists:keyfind(http_only, 1, Opts) of
|
|
false -> <<>>;
|
|
false -> <<>>;
|
|
|
|
+ {_, false} -> <<>>;
|
|
{_, true} -> <<"; HttpOnly">>
|
|
{_, true} -> <<"; HttpOnly">>
|
|
end,
|
|
end,
|
|
[Name, <<"=">>, Value, <<"; Version=1">>,
|
|
[Name, <<"=">>, Value, <<"; Version=1">>,
|
|
@@ -218,6 +220,12 @@ setcookie_test_() ->
|
|
[{path, <<"/acme">>}],
|
|
[{path, <<"/acme">>}],
|
|
<<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>},
|
|
<<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>},
|
|
{<<"Customer">>, <<"WILE_E_COYOTE">>,
|
|
{<<"Customer">>, <<"WILE_E_COYOTE">>,
|
|
|
|
+ [{secure, true}],
|
|
|
|
+ <<"Customer=WILE_E_COYOTE; Version=1; Secure">>},
|
|
|
|
+ {<<"Customer">>, <<"WILE_E_COYOTE">>,
|
|
|
|
+ [{secure, false}, {http_only, false}],
|
|
|
|
+ <<"Customer=WILE_E_COYOTE; Version=1">>},
|
|
|
|
+ {<<"Customer">>, <<"WILE_E_COYOTE">>,
|
|
[{path, <<"/acme">>}, {badoption, <<"negatory">>}],
|
|
[{path, <<"/acme">>}, {badoption, <<"negatory">>}],
|
|
<<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>}
|
|
<<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>}
|
|
],
|
|
],
|