changeset 5526:d5b9c74c910e

httprepo: give self._url and the netloc to the password manager This should hide some differences between different python versions.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 09 Nov 2007 20:21:35 -0200
parents dcbda0c4c3eb
children 0b3f910dfd17
files mercurial/httprepo.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httprepo.py	Mon Nov 05 20:29:32 2007 +0100
+++ b/mercurial/httprepo.py	Fri Nov 09 20:21:35 2007 -0200
@@ -256,7 +256,11 @@
         if user:
             ui.debug(_('http auth: user %s, password %s\n') %
                      (user, passwd and '*' * len(passwd) or 'not set'))
-            passmgr.add_password(None, host, user, passwd or '')
+            netloc = host
+            if port:
+                netloc += ':' + port
+            # Python < 2.4.3 uses only the netloc to search for a password
+            passmgr.add_password(None, (self._url, netloc), user, passwd or '')
 
         handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
                          httpdigestauthhandler(passmgr)))