From da7024fb0b193a069589d5fde245ccf784bbddb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 16 Dec 2014 17:47:08 +0200 Subject: Add cow_http_hd:parse_if_unmodified_since/1 --- src/cow_http_hd.erl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/cow_http_hd.erl') 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(). -- cgit v1.2.3