You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2010/05/19 23:55:56 UTC
svn commit: r946429 - /couchdb/branches/0.11.x/src/couchdb/couch_rep.erl
Author: jan
Date: Wed May 19 21:55:55 2010
New Revision: 946429
URL: http://svn.apache.org/viewvc?rev=946429&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/branches/0.11.x/src/couchdb/couch_rep.erl
Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep.erl?rev=946429&r1=946428&r2=946429&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_rep.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_rep.erl Wed May 19 21:55:55 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];