diff options
-rw-r--r-- | src/cowboy_clock.erl | 5 | ||||
-rw-r--r-- | src/cowboy_cookies.erl | 18 |
2 files changed, 8 insertions, 15 deletions
diff --git a/src/cowboy_clock.erl b/src/cowboy_clock.erl index 333df94..66fc009 100644 --- a/src/cowboy_clock.erl +++ b/src/cowboy_clock.erl @@ -69,6 +69,10 @@ stop() -> rfc1123() -> ets:lookup_element(?TABLE, rfc1123, 2). +%% @doc Return the current date and time formatted according to RFC-2109. +%% +%% This format is used in the <em>'Set-Cookie'</em> header sent with +%% HTTP responses. -spec rfc2109(datetime()) -> binary(). rfc2109(LocalTime) -> {{YYYY,MM,DD},{Hour,Min,Sec}} = @@ -91,7 +95,6 @@ rfc2109(LocalTime) -> MinBin/binary, ":", SecBin/binary, " GMT">>. - %% gen_server. %% @private diff --git a/src/cowboy_cookies.erl b/src/cowboy_cookies.erl index 8a11b19..3a50ba6 100644 --- a/src/cowboy_cookies.erl +++ b/src/cowboy_cookies.erl @@ -17,8 +17,7 @@ -module(cowboy_cookies). -%% API. --export([parse_cookie/1, cookie/3, cookie/2]). +-export([parse_cookie/1, cookie/3, cookie/2]). %% API. %% Types. -type kv() :: {Name::binary(), Value::binary()}. @@ -33,10 +32,7 @@ -include_lib("eunit/include/eunit.hrl"). - -%% ---------------------------------------------------------------------------- -%% API -%% ---------------------------------------------------------------------------- +%% API. %% @doc Parse the contents of a Cookie header field, ignoring cookie %% attributes, and return a simple property list. @@ -110,10 +106,7 @@ cookie(Key, Value, Options) when is_binary(Key) andalso is_binary(Value) andalso CookieParts = <<Cookie/binary, ExpiresPart/binary, SecurePart/binary, DomainPart/binary, PathPart/binary, HttpOnlyPart/binary>>, {<<"Set-Cookie">>, CookieParts}. - -%% ---------------------------------------------------------------------------- -%% Private -%% ---------------------------------------------------------------------------- +%% Internal. %% @doc Check if a character is a white space character. -spec is_whitespace(char()) -> boolean(). @@ -231,7 +224,6 @@ read_quoted(<<$\\, Any, Rest/binary>>, Acc) -> read_quoted(<<C, Rest/binary>>, Acc) -> read_quoted(Rest, <<Acc/binary, C>>). - %% @doc Drop characters while a function returns true. -spec binary_dropwhile(fun((char()) -> boolean()), binary()) -> binary(). binary_dropwhile(_F, <<"">>) -> @@ -294,9 +286,7 @@ any_to_binary(V) when is_atom(V) -> any_to_binary(V) when is_integer(V) -> list_to_binary(integer_to_list(V)). -%% ---------------------------------------------------------------------------- -%% Tests -%% ---------------------------------------------------------------------------- +%% Tests. -ifdef(TEST). |