Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 15024:0f1311e829c9 stable
http: strip credentials from urllib2 manager URIs (issue2885)
urllib2 password manager does not strip credentials from URIs registered with
add_password() and compare them with stripped URIs in find_password(). Remove
credentials from URIs returned by util.url.authinfo(). It sometimes works when
no port was specified as the URI host is registered too.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 05 Aug 2011 21:05:40 +0200 |
parents | e89f62dcd723 |
children | 1e45b92f4fb2 24a6c3f903bb |
comparison
equal
deleted
inserted
replaced
15019:f4b7be3f8430 | 15024:0f1311e829c9 |
---|---|
1563 s = str(self) | 1563 s = str(self) |
1564 finally: | 1564 finally: |
1565 self.user, self.passwd = user, passwd | 1565 self.user, self.passwd = user, passwd |
1566 if not self.user: | 1566 if not self.user: |
1567 return (s, None) | 1567 return (s, None) |
1568 return (s, (None, (str(self), self.host), | 1568 # authinfo[1] is passed to urllib2 password manager, and its URIs |
1569 # must not contain credentials. | |
1570 return (s, (None, (s, self.host), | |
1569 self.user, self.passwd or '')) | 1571 self.user, self.passwd or '')) |
1570 | 1572 |
1571 def isabs(self): | 1573 def isabs(self): |
1572 if self.scheme and self.scheme != 'file': | 1574 if self.scheme and self.scheme != 'file': |
1573 return True # remote URL | 1575 return True # remote URL |