couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r946428 - /couchdb/trunk/src/couchdb/couch_rep.erl
Date Wed, 19 May 2010 21:52:31 GMT
Author: jan
Date: Wed May 19 21:52:31 2010
New Revision: 946428

URL: http://svn.apache.org/viewvc?rev=946428&view=rev
Log:
Strip password from URLs before adding them to the tasks database
and before sending it to the logger.

Closes COUCHDB-756.

Modified:
    couchdb/trunk/src/couchdb/couch_rep.erl

Modified: couchdb/trunk/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep.erl?rev=946428&r1=946427&r2=946428&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep.erl Wed May 19 21:52:31 2010
@@ -350,10 +350,16 @@ close_db(Db) ->
     couch_db:close(Db).
 
 dbname(#http_db{url = Url}) ->
-    Url;
+    strip_password(Url);
 dbname(#db{name = Name}) ->
     Name.
 
+strip_password(Url) ->
+    re:replace(Url,
+        "http(s)?://([^:]+):[^@]+@(.*)$",
+        "http\\1://\\2:*****@\\3",
+        [{return, list}]).
+
 dbinfo(#http_db{} = Db) ->
     {DbProps} = couch_rep_httpc:request(Db),
     [{list_to_atom(?b2l(K)), V} || {K,V} <- DbProps];



Mime
View raw message