diff options
author | Loïc Hoguin <[email protected]> | 2014-12-16 23:20:16 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-16 23:20:16 +0200 |
commit | 38f9b0cf699cb57aa8384128ca5c34ee93df57a0 (patch) | |
tree | 4b01f26e1b15cb75d4c1857df1dbd029d9336125 /src | |
parent | a2aa7c155496d3dcd02113479dfedbd220c4144b (diff) | |
download | cowlib-38f9b0cf699cb57aa8384128ca5c34ee93df57a0.tar.gz cowlib-38f9b0cf699cb57aa8384128ca5c34ee93df57a0.tar.bz2 cowlib-38f9b0cf699cb57aa8384128ca5c34ee93df57a0.zip |
Add cow_http_hd:parse_last_modified/1
From RFC7232.
Diffstat (limited to 'src')
-rw-r--r-- | src/cow_http_hd.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index d2107cf..5add28a 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -25,6 +25,7 @@ -export([parse_expect/1]). -export([parse_if_modified_since/1]). -export([parse_if_unmodified_since/1]). +-export([parse_last_modified/1]). -export([parse_max_forwards/1]). -export([parse_transfer_encoding/1]). @@ -1038,6 +1039,20 @@ parse_if_unmodified_since_test_() -> [{V, fun() -> R = parse_if_unmodified_since(V) end} || {V, R} <- Tests]. -endif. +%% @doc Parse the Last-Modified header. + +-spec parse_last_modified(binary()) -> calendar:datetime(). +parse_last_modified(LastModified) -> + http_date(LastModified). + +-ifdef(TEST). +parse_last_modified_test_() -> + Tests = [ + {<<"Tue, 15 Nov 1994 12:45:26 GMT">>, {{1994, 11, 15}, {12, 45, 26}}} + ], + [{V, fun() -> R = parse_last_modified(V) end} || {V, R} <- Tests]. +-endif. + %% @doc Parse the Max-Forwards header. -spec parse_max_forwards(binary()) -> integer(). |