diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2009-08-10 18:37:43 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2009-08-10 18:37:43 +0000 |
commit | 5dcbc2290ac780f1a625b5c9435cfb35eac4e1ef (patch) | |
tree | bc9e04c73807b9eb34e05d5c70026b2e951fc673 /src/couchdb/couch_httpd_misc_handlers.erl | |
parent | abcc5a35fda60c7124af7899939f09e59ae7968b (diff) |
new replicator using _changes feed for continuous replication
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@802888 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_misc_handlers.erl')
-rw-r--r-- | src/couchdb/couch_httpd_misc_handlers.erl | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl index eea353bd..c4f28308 100644 --- a/src/couchdb/couch_httpd_misc_handlers.erl +++ b/src/couchdb/couch_httpd_misc_handlers.erl @@ -77,32 +77,9 @@ handle_task_status_req(#httpd{method='GET'}=Req) -> handle_task_status_req(Req) -> send_method_not_allowed(Req, "GET,HEAD"). -% add trailing slash if missing -fix_db_url(UrlBin) -> - ?l2b(case lists:last(Url = ?b2l(UrlBin)) of - $/ -> Url; - _ -> Url ++ "/" - end). - - -get_rep_endpoint(_Req, {Props}) -> - Url = proplists:get_value(<<"url">>, Props), - {BinHeaders} = proplists:get_value(<<"headers">>, Props, {[]}), - Auth = proplists:get_value(<<"auth">>, Props, undefined), - ?LOG_DEBUG("AUTH ~p", [Auth]), - {remote, fix_db_url(Url), [{?b2l(K),?b2l(V)} || {K,V} <- BinHeaders], Auth}; -get_rep_endpoint(_Req, <<"http://",_/binary>>=Url) -> - {remote, fix_db_url(Url), [], []}; -get_rep_endpoint(_Req, <<"https://",_/binary>>=Url) -> - {remote, fix_db_url(Url), [], []}; -get_rep_endpoint(#httpd{user_ctx=UserCtx}, <<DbName/binary>>) -> - {local, DbName, UserCtx}. - handle_replicate_req(#httpd{method='POST'}=Req) -> - {Props} = couch_httpd:json_body_obj(Req), - Source = get_rep_endpoint(Req, proplists:get_value(<<"source">>, Props)), - Target = get_rep_endpoint(Req, proplists:get_value(<<"target">>, Props)), - case couch_rep:replicate(Source, Target) of + PostBody = couch_httpd:json_body_obj(Req), + case couch_rep:replicate(PostBody, Req#httpd.user_ctx) of {ok, {JsonResults}} -> send_json(Req, {[{ok, true} | JsonResults]}); {error, {Type, Details}} -> |