From 2f27b046d71ed439e8a58e2f661e2a84a1d9bea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 9 Nov 2011 21:41:33 +0100 Subject: Add 'If-Match' and 'If-None-Match' to parse_header/2 --- src/cowboy_http_req.erl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cowboy_http_req.erl') 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. @@ -242,6 +244,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-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, -- cgit v1.2.3