diff options
author | Jan Lehnardt <jan@apache.org> | 2010-05-19 21:52:31 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2010-05-19 21:52:31 +0000 |
commit | 75f22af1b3cf80af11af6bda875fcd68b831e1f2 (patch) | |
tree | e3f769b811d92b309295509ac57ae9a3aa960cdc | |
parent | 082cbb1bb9b84803c40af1946342112a471fad3a (diff) |
Strip password from URLs before adding them to the tasks database
and before sending it to the logger.
Closes COUCHDB-756.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@946428 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/couchdb/couch_rep.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl index 3daf8170..6be37f0b 100644 --- a/src/couchdb/couch_rep.erl +++ b/src/couchdb/couch_rep.erl @@ -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]; |