aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_req.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-11-05 01:49:03 +0100
committerLoïc Hoguin <[email protected]>2011-11-05 01:49:03 +0100
commitaba1ea46360a1f84f71102ca3727b584faad8946 (patch)
tree17bc18527f6a24a7535cc7f1dbf557c55c5f9e6b /src/cowboy_http_req.erl
parentaadd974f06ac1f089f7098c2ffe6f23d108f55be (diff)
downloadcowboy-aba1ea46360a1f84f71102ca3727b584faad8946.tar.gz
cowboy-aba1ea46360a1f84f71102ca3727b584faad8946.tar.bz2
cowboy-aba1ea46360a1f84f71102ca3727b584faad8946.zip
Add 'If-Modified-Since' and 'If-Unmodified-Since' to parse_header/2
Implementing the full HTTP-date type (RFC1123, RFC850, asctime).
Diffstat (limited to 'src/cowboy_http_req.erl')
-rw-r--r--src/cowboy_http_req.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 911aca1..2b17f9c 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -236,6 +236,12 @@ parse_header(Name, Req, Default) when Name =:= 'Content-Length' ->
fun (Value) ->
cowboy_http:digits(Value)
end);
+parse_header(Name, Req, Default)
+ when Name =:= 'If-Modified-Since'; Name =:= 'If-Unmodified-Since' ->
+ parse_header(Name, Req, Default,
+ fun (Value) ->
+ cowboy_http:http_date(Value)
+ end);
parse_header(Name, Req, Default) ->
{Value, Req2} = header(Name, Req, Default),
{undefined, Value, Req2}.