summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-12-19 22:26:34 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-12-19 22:26:34 +0000
commit254fc2ac67ab1e5452cc3fd11aadfe3b0aa805e1 (patch)
treead71a5f7c7ab148f40536bda79652621ea13cda6 /src
parent1326c40d66563279dcce712f130c10e5d1d80a03 (diff)
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.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@728177 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_httpd_db.erl16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index fbea4541..119c20ee 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -612,18 +612,18 @@ parse_doc_query(Req) ->
-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.