You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/05/07 17:10:08 UTC

[couchdb] branch dry-etag-generation created (now 3deee947c)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch dry-etag-generation
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at 3deee947c Remove duplicate etag generation function

This branch includes the following new commits:

     new 3deee947c Remove duplicate etag generation function

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Remove duplicate etag generation function

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch dry-etag-generation
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 3deee947c5e3fe87b1d716d482d22152d8e2431a
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Sun May 7 13:08:47 2023 -0400

    Remove duplicate etag generation function
    
    Use the couch_httpd one as it would be odd for couch_httpd to call chttpd.
---
 src/chttpd/src/chttpd.erl     | 3 +--
 src/couch/src/couch_httpd.erl | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index ee1219511..689af7cef 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -813,8 +813,7 @@ doc_etag(#doc{id = Id, body = Body, revs = {Start, [DiskRev | _]}}) ->
     couch_httpd:doc_etag(Id, Body, {Start, DiskRev}).
 
 make_etag(Term) ->
-    <<SigInt:128/integer>> = exxhash:xxhash128(term_to_binary(Term)),
-    list_to_binary(io_lib:format("\"~.36B\"", [SigInt])).
+    couch_httpd:make_etag(Term).
 
 etag_match(Req, CurrentEtag) when is_binary(CurrentEtag) ->
     etag_match(Req, binary_to_list(CurrentEtag));
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 76f8279f6..839404798 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -745,8 +745,8 @@ rev_etag({Start, DiskRev}) ->
     <<$", Rev/binary, $">>.
 
 make_etag(Term) ->
-    <<SigInt:128/integer>> = couch_hash:md5_hash(term_to_binary(Term)),
-    iolist_to_binary([$", io_lib:format("~.36B", [SigInt]), $"]).
+    <<SigInt:128/integer>> = exxhash:xxhash128(term_to_binary(Term)),
+    list_to_binary(io_lib:format("\"~.36B\"", [SigInt])).
 
 etag_match(Req, CurrentEtag) when is_binary(CurrentEtag) ->
     etag_match(Req, binary_to_list(CurrentEtag));