aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_clock.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-10-23 11:21:31 +0200
committerLoïc Hoguin <[email protected]>2013-10-23 16:35:23 +0200
commitfaf64524c6758ae1e27404d2ae1383a23538c538 (patch)
tree1aed9b3434d9b38e67ceca1c1e09cd05f5222967 /src/cowboy_clock.erl
parentaab63d605c595d8d0cd33646d13942d6cb372b60 (diff)
downloadcowboy-faf64524c6758ae1e27404d2ae1383a23538c538.tar.gz
cowboy-faf64524c6758ae1e27404d2ae1383a23538c538.tar.bz2
cowboy-faf64524c6758ae1e27404d2ae1383a23538c538.zip
Move cookie parsing/building code to cowlib
The code for parsing has also been rewritten to be more efficient and to be able to handle cookie values with space inside them properly. Update cowlib to 0.2.0.
Diffstat (limited to 'src/cowboy_clock.erl')
-rw-r--r--src/cowboy_clock.erl20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/cowboy_clock.erl b/src/cowboy_clock.erl
index f21616c..6fb522b 100644
--- a/src/cowboy_clock.erl
+++ b/src/cowboy_clock.erl
@@ -26,7 +26,6 @@
-export([stop/0]).
-export([rfc1123/0]).
-export([rfc1123/1]).
--export([rfc2109/1]).
%% gen_server.
-export([init/1]).
@@ -67,18 +66,6 @@ rfc1123() ->
rfc1123(DateTime) ->
update_rfc1123(<<>>, undefined, DateTime).
-%% @doc Return the given 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(calendar:datetime()) -> binary().
-rfc2109({Date = {Y, Mo, D}, {H, Mi, S}}) ->
- Wday = calendar:day_of_the_week(Date),
- << (weekday(Wday))/binary, ", ", (pad_int(D))/binary, "-",
- (month(Mo))/binary, "-", (list_to_binary(integer_to_list(Y)))/binary,
- " ", (pad_int(H))/binary, $:, (pad_int(Mi))/binary,
- $:, (pad_int(S))/binary, " GMT" >>.
-
%% gen_server.
%% @private
@@ -188,13 +175,6 @@ month(12) -> <<"Dec">>.
-ifdef(TEST).
-rfc2109_test_() ->
- Tests = [
- {<<"Sat, 14-May-2011 14:25:33 GMT">>, {{2011, 5, 14}, {14, 25, 33}}},
- {<<"Sun, 01-Jan-2012 00:00:00 GMT">>, {{2012, 1, 1}, { 0, 0, 0}}}
- ],
- [{R, fun() -> R = rfc2109(D) end} || {R, D} <- Tests].
-
update_rfc1123_test_() ->
Tests = [
{<<"Sat, 14 May 2011 14:25:33 GMT">>, undefined,