[PATCH] hide passwords in httprepo error messages

Steve Borho steve at borho.org
Sat Apr 11 18:34:45 CDT 2009


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1239492861 18000
# Node ID a9bc0242f1e3c607f06f78b94542917b39116404
# Parent  db3a68fd9387d10308148bbf1a18c89bf50ce96d
hide passwords in httprepo error messages

diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -99,13 +99,14 @@
         except AttributeError:
             proto = resp.headers['content-type']
 
+        safeurl = url.hidepassword(self._url)
         # accept old "text/plain" and "application/hg-changegroup" for now
         if not (proto.startswith('application/mercurial-') or
                 proto.startswith('text/plain') or
                 proto.startswith('application/hg-changegroup')):
             self.ui.debug(_("requested URL: '%s'\n") % cu)
             raise error.RepoError(_("'%s' does not appear to be an hg repository")
-                                  % self._url)
+                                  % safeurl)
 
         if proto.startswith('application/mercurial-'):
             try:
@@ -113,10 +114,10 @@
                 version_info = tuple([int(n) for n in version.split('.')])
             except ValueError:
                 raise error.RepoError(_("'%s' sent a broken Content-Type "
-                                        "header (%s)") % (self._url, proto))
+                                        "header (%s)") % (safeurl, proto))
             if version_info > (0, 1):
                 raise error.RepoError(_("'%s' uses newer protocol %s") %
-                                      (self._url, version))
+                                      (safeurl, version))
 
         return resp
 


More information about the Mercurial-devel mailing list