Author: cmlenz Date: Fri Dec 19 14:26:34 2008 New Revision: 728177 URL: http://svn.apache.org/viewvc?rev=728177&view=rev Log: Fix Etag checking for document requests: need to convert Etag header value to binary early, as the `ExplicitRev` is already a binary, thus the comparison would fail. Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=728177&r1=728176&r2=728177&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Fri Dec 19 14:26:34 2008 @@ -612,18 +612,18 @@ -extract_header_rev(Req, ExplictRev) when is_list(ExplictRev)-> - extract_header_rev(Req, list_to_binary(ExplictRev)); -extract_header_rev(Req, ExplictRev) -> +extract_header_rev(Req, ExplicitRev) when is_list(ExplicitRev)-> + extract_header_rev(Req, list_to_binary(ExplicitRev)); +extract_header_rev(Req, ExplicitRev) -> Etag = case couch_httpd:header_value(Req, "If-Match") of undefined -> undefined; - Tag -> string:strip(Tag, both, $") + Value -> list_to_binary(string:strip(Value, both, $")) end, - case {ExplictRev, Etag} of + case {ExplicitRev, Etag} of {undefined, undefined} -> missing_rev; - {_, undefined} -> ExplictRev; - {undefined, _} -> list_to_binary(Etag); - _ when ExplictRev == Etag -> list_to_binary(Etag); + {_, undefined} -> ExplicitRev; + {undefined, _} -> Etag; + _ when ExplicitRev == Etag -> Etag; _ -> throw({bad_request, "Document rev and etag have different values"}) end.