anchor.diff:      Port = mochiweb_socket_server:get(couch_httpd, port),
       Src = get_rep_endpoint(UserCtx, ?getv(<<"source">>, Props)),
       Tgt = get_rep_endpoint(UserCtx, ?getv(<<"target">>, Props)),
  -    maybe_append_filters({Props}, [HostName, Port, Src, Tgt]);
  +    maybe_append_filters({Props}, [HostName, Port, Src, Tgt], UserCtx);
   make_replication_id({Props}, UserCtx, 1) ->
       {ok, HostName} = inet:gethostname(),
       Src = get_rep_endpoint(UserCtx, ?getv(<<"source">>, Props)),
       Tgt = get_rep_endpoint(UserCtx, ?getv(<<"target">>, Props)),
  -    maybe_append_filters({Props}, [HostName, Src, Tgt]).
  -
  -maybe_append_filters({Props}, Base) ->
  +    maybe_append_filters({Props}, [HostName, Src, Tgt], UserCtx).
  +
  +maybe_append_filters({Props}, Base, UserCtx) ->
       Base2 = Base ++ 
           case ?getv(<<"filter">>, Props) of
           undefined ->
  
positive.code:                 [DocIds]
              end;
          Filter ->
              [Filter, ?getv(<<"query_params">>, Props, {[]})]
          end,
      couch_util:to_hex(couch_util:md5(term_to_binary(Base2))).
  
  maybe_add_trailing_slash(Url) ->
      re:replace(Url, "[^/]$", "&/", [{return, list}]).
  
negative.code:             RepProps, UserCtx, [MigratedLog|Acc])
      end.
  
  open_replication_log(Db, DocId) ->
      case open_doc(Db, DocId) of
      {ok, Doc} ->
          ?LOG_DEBUG("found a replication log for ~s", [dbname(Db)]),
          {ok, Doc};
      _ ->
          ?LOG_DEBUG("didn't find a replication log for ~s", [dbname(Db)]),
          {error, not_found}
      end.
  
  open_doc(#http_db{} = Db, DocId) ->
      Req = Db#http_db{resource = couch_util:encode_doc_id(DocId)},
      case couch_rep_httpc:request(Req) of
      {[{<<"error">>, _}, {<<"reason">>, _}]} ->
          {error, not_found};
      Doc ->
          {ok, couch_doc:from_json_obj(Doc)}
      end;
  open_doc(Db, DocId) ->
      couch_db:open_doc(Db, DocId).
  
  open_db(Props, UserCtx, ProxyParams) ->
      open_db(Props, UserCtx, ProxyParams, false).
  