aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-06-06 17:33:46 +0200
committerLoïc Hoguin <[email protected]>2016-06-06 17:33:46 +0200
commit493794145ef51a8402f0e07d5a28ea64597c9945 (patch)
treea66a563464200c5860884b27771c3653c31b1e64 /src
parent6d6355723529ed3423c3d8b3c3ca9a29089e9f23 (diff)
downloadcowboy-493794145ef51a8402f0e07d5a28ea64597c9945.tar.gz
cowboy-493794145ef51a8402f0e07d5a28ea64597c9945.tar.bz2
cowboy-493794145ef51a8402f0e07d5a28ea64597c9945.zip
REST: Ignore If...Since if If...Match header exists
The If-Modified-Since and If-Unmodified-Since headers are only used when If-None-Match or If-Match were not found, respectively. The latter are preferred by the standard and the former is only there for compatibility with older clients.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_rest.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl
index 670e74b..55b4e22 100644
--- a/src/cowboy_rest.erl
+++ b/src/cowboy_rest.erl
@@ -688,7 +688,7 @@ if_match(Req, State, EtagsList) ->
precondition_failed(Req2, State2);
{Etag, Req2, State2} ->
case lists:member(Etag, EtagsList) of
- true -> if_unmodified_since_exists(Req2, State2);
+ true -> if_none_match_exists(Req2, State2);
%% Etag may be `undefined' which cannot be a member.
false -> precondition_failed(Req2, State2)
end
@@ -743,7 +743,7 @@ if_none_match(Req, State, EtagsList) ->
Etag ->
case is_weak_match(Etag, EtagsList) of
true -> precondition_is_head_get(Req2, State2);
- false -> if_modified_since_exists(Req2, State2)
+ false -> method(Req2, State2)
end
end
catch Class:Reason ->