diff options
author | Loïc Hoguin <[email protected]> | 2014-12-16 17:47:08 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-16 17:47:08 +0200 |
commit | da7024fb0b193a069589d5fde245ccf784bbddb9 (patch) | |
tree | 912604fb6f8eb343f0cbc7202058d67f31d44c1c /src/cow_http_hd.erl | |
parent | e5cbfe3563543ef67ec4c45ffe0d9b0898a868eb (diff) | |
download | cowlib-da7024fb0b193a069589d5fde245ccf784bbddb9.tar.gz cowlib-da7024fb0b193a069589d5fde245ccf784bbddb9.tar.bz2 cowlib-da7024fb0b193a069589d5fde245ccf784bbddb9.zip |
Add cow_http_hd:parse_if_unmodified_since/1
Diffstat (limited to 'src/cow_http_hd.erl')
-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 0728a47..89f9ac9 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -23,6 +23,7 @@ -export([parse_content_type/1]). -export([parse_expect/1]). -export([parse_if_modified_since/1]). +-export([parse_if_unmodified_since/1]). -export([parse_max_forwards/1]). -export([parse_transfer_encoding/1]). @@ -1008,6 +1009,20 @@ parse_if_modified_since_test_() -> [{V, fun() -> R = parse_if_modified_since(V) end} || {V, R} <- Tests]. -endif. +%% @doc Parse the If-Unmodified-Since header. + +-spec parse_if_unmodified_since(binary()) -> calendar:datetime(). +parse_if_unmodified_since(IfModifiedSince) -> + http_date(IfModifiedSince). + +-ifdef(TEST). +parse_if_unmodified_since_test_() -> + Tests = [ + {<<"Sat, 29 Oct 1994 19:43:31 GMT">>, {{1994, 10, 29}, {19, 43, 31}}} + ], + [{V, fun() -> R = parse_if_unmodified_since(V) end} || {V, R} <- Tests]. +-endif. + %% @doc Parse the Max-Forwards header. -spec parse_max_forwards(binary()) -> integer(). |