couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r998147 - in /couchdb/branches/new_replicator/src/couchdb: couch_api_wrap.erl couch_api_wrap_httpc.erl couch_util.erl
Date Fri, 17 Sep 2010 14:17:25 GMT
Author: fdmanana
Date: Fri Sep 17 14:17:24 2010
New Revision: 998147

URL: http://svn.apache.org/viewvc?rev=998147&view=rev
Log:
Moving function into couch_util, just like in trunk.

Modified:
    couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl
    couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl
    couchdb/branches/new_replicator/src/couchdb/couch_util.erl

Modified: couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl?rev=998147&r1=998146&r2=998147&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl Fri Sep 17 14:17:24 2010
@@ -60,7 +60,7 @@
 
 
 db_uri(#httpdb{url = Url}) ->
-    couch_api_wrap_httpc:strip_creds(Url);
+    couch_util:url_strip_password(Url);
 
 db_uri(#db{name = Name}) ->
     ?b2l(Name).

Modified: couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl?rev=998147&r1=998146&r2=998147&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl Fri Sep 17 14:17:24
2010
@@ -17,7 +17,7 @@
 -include("../ibrowse/ibrowse.hrl").
 
 -export([httpdb_setup/1]).
--export([send_req/3, strip_creds/1]).
+-export([send_req/3]).
 
 -import(couch_util, [
     get_value/2,
@@ -108,7 +108,7 @@ report_error(Worker, #httpdb{timeout = T
 
 report_error(Worker, HttpDb, Params, Error) ->
     Method = string:to_upper(atom_to_list(get_value(method, Params, get))),
-    Url = strip_creds(full_url(HttpDb, Params)),
+    Url = couch_util:url_strip_password(full_url(HttpDb, Params)),
     do_report_error(Url, Method, Error),
     stop_worker(Worker),
     exit({http_request_failed, Method, Url, Error}).
@@ -147,13 +147,6 @@ full_url(#httpdb{url = BaseUrl}, Params)
     BaseUrl ++ Path ++ query_args_to_string(QueryArgs, []).
 
 
-strip_creds(Url) ->
-    re:replace(Url,
-        "http(s)?://([^:]+):[^@]+@(.*)$",
-        "http\\1://\\2:*****@\\3",
-        [{return, list}]).
-
-
 query_args_to_string([], []) ->
     "";
 query_args_to_string([], Acc) ->

Modified: couchdb/branches/new_replicator/src/couchdb/couch_util.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_util.erl?rev=998147&r1=998146&r2=998147&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_util.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_util.erl Fri Sep 17 14:17:24 2010
@@ -25,6 +25,7 @@
 -export([compressible_att_type/1]).
 -export([get_value/2, get_value/3]).
 -export([md5/1, md5_init/0, md5_update/2, md5_final/1]).
+-export([url_strip_password/1]).
 
 -include("couch_db.hrl").
 -include_lib("kernel/include/file.hrl").
@@ -429,3 +430,9 @@ md5_update(Ctx, D) ->
 -spec md5_final(Context::binary()) -> Digest::binary().
 md5_final(Ctx) ->
     try crypto:md5_final(Ctx) catch error:_ -> erlang:md5_final(Ctx) end.
+
+url_strip_password(Url) ->
+    re:replace(Url,
+        "http(s)?://([^:]+):[^@]+@(.*)$",
+        "http\\1://\\2:*****@\\3",
+        [{return, list}]).



Mime
View raw message