aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_req.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-11-09 21:41:33 +0100
committerLoïc Hoguin <[email protected]>2011-11-09 21:41:33 +0100
commit2f27b046d71ed439e8a58e2f661e2a84a1d9bea4 (patch)
tree7e137d6f3b6052d81df1742026d72d8752d7e836 /src/cowboy_http_req.erl
parent12b9ca352616afcf865670df9e2186df213bd9f1 (diff)
downloadcowboy-2f27b046d71ed439e8a58e2f661e2a84a1d9bea4.tar.gz
cowboy-2f27b046d71ed439e8a58e2f661e2a84a1d9bea4.tar.bz2
cowboy-2f27b046d71ed439e8a58e2f661e2a84a1d9bea4.zip
Add 'If-Match' and 'If-None-Match' to parse_header/2
Diffstat (limited to 'src/cowboy_http_req.erl')
-rw-r--r--src/cowboy_http_req.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index feb795c..12d117f 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -205,6 +205,8 @@ parse_header_default('Accept-Charset') -> [];
parse_header_default('Accept-Encoding') -> [];
parse_header_default('Accept-Language') -> [];
parse_header_default('Connection') -> [];
+parse_header_default('If-Match') -> '*';
+parse_header_default('If-None-Match') -> '*';
parse_header_default(_Name) -> undefined.
%% @doc Semantically parse headers.
@@ -243,6 +245,12 @@ parse_header(Name, Req, Default) when Name =:= 'Content-Length' ->
cowboy_http:digits(Value)
end);
parse_header(Name, Req, Default)
+ when Name =:= 'If-Match'; Name =:= 'If-None-Match' ->
+ parse_header(Name, Req, Default,
+ fun (Value) ->
+ cowboy_http:entity_tag_match(Value)
+ end);
+parse_header(Name, Req, Default)
when Name =:= 'If-Modified-Since'; Name =:= 'If-Unmodified-Since' ->
parse_header(Name, Req, Default,
fun (Value) ->