summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2010-03-21 20:02:37 +0000
committerJan Lehnardt <jan@apache.org>2010-03-21 20:02:37 +0000
commitd0d251175a2800b44ef337663c04d7cfc207d711 (patch)
tree5bebd5f8b173d4704ce6b1b7ad538aebe77d48ad /src
parent801a8d7a41d09862437196fc12b80f1a979c2c99 (diff)
Take query options into account when generating replication ids.
Patch by Filipe Manana. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@925879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_rep.erl23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl
index 8e83ebca..b7f87901 100644
--- a/src/couchdb/couch_rep.erl
+++ b/src/couchdb/couch_rep.erl
@@ -451,20 +451,21 @@ make_replication_id({Props}, UserCtx) ->
% Port = mochiweb_socket_server:get(couch_httpd, port),
Src = get_rep_endpoint(UserCtx, proplists:get_value(<<"source">>, Props)),
Tgt = get_rep_endpoint(UserCtx, proplists:get_value(<<"target">>, Props)),
- Filter = proplists:get_value(<<"filter">>, Props),
- QueryParams = proplists:get_value(<<"query_params">>, Props),
- DocIds = proplists:get_value(<<"doc_ids">>, Props),
- Base = couch_util:to_hex(erlang:md5(
- case DocIds of
+ Base = [HostName, Src, Tgt] ++
+ case proplists:get_value(<<"filter">>, Props) of
undefined ->
- term_to_binary([HostName, Src, Tgt, Filter, QueryParams]);
- DocIds ->
- term_to_binary([HostName, Src, Tgt, Filter, QueryParams, DocIds])
- end
- )),
+ case proplists:get_value(<<"doc_ids">>, Props) of
+ undefined ->
+ [];
+ DocIds ->
+ [DocIds]
+ end;
+ Filter ->
+ [Filter, proplists:get_value(<<"query_params">>, Props, {[]})]
+ end,
Extension = maybe_append_options(
[<<"continuous">>, <<"create_target">>], Props),
- {Base, Extension}.
+ {couch_util:to_hex(erlang:md5(term_to_binary(Base))), Extension}.
maybe_add_trailing_slash(Url) ->
re:replace(Url, "[^/]$", "&/", [{return, list}]).