Browse Source

REST: If-Match uses strong Etag comparison

Weak Etag never matches.
Loïc Hoguin 9 years ago
parent
commit
68c57430da
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/cowboy_rest.erl

+ 3 - 0
src/cowboy_rest.erl

@@ -683,6 +683,9 @@ if_match_exists(Req, State) ->
 
 
 if_match(Req, State, EtagsList) ->
 if_match(Req, State, EtagsList) ->
 	try generate_etag(Req, State) of
 	try generate_etag(Req, State) of
+		%% Strong Etag comparison: weak Etag never matches.
+		{{weak, _}, Req2, State2} ->
+			precondition_failed(Req2, State2);
 		{Etag, Req2, State2} ->
 		{Etag, Req2, State2} ->
 			case lists:member(Etag, EtagsList) of
 			case lists:member(Etag, EtagsList) of
 				true -> if_unmodified_since_exists(Req2, State2);
 				true -> if_unmodified_since_exists(Req2, State2);