Patchwork D2599: url: more bytes/unicodes fussing in url.py around auth handling

login
register
mail settings
Submitter phabricator
Date March 3, 2018, 8:15 p.m.
Message ID <09533d74c343f2a440205f3132937837@localhost.localdomain>
Download mbox | patch
Permalink /patch/28826/
State Not Applicable
Headers show

Comments

phabricator - March 3, 2018, 8:15 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8381126bf43c: url: more bytes/unicodes fussing in url.py around auth handling (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2599?vs=6451&id=6463

REVISION DETAIL
  https://phab.mercurial-scm.org/D2599

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/url.py

CHANGE DETAILS




To: durin42, pulkit, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -67,15 +67,15 @@ 
                 user, passwd = auth.get('username'), auth.get('password')
                 self.ui.debug("using auth.%s.* for authentication\n" % group)
         if not user or not passwd:
-            u = util.url(authuri)
+            u = util.url(pycompat.bytesurl(authuri))
             u.query = None
             if not self.ui.interactive():
                 raise error.Abort(_('http authorization required for %s') %
                                   util.hidepassword(bytes(u)))
 
             self.ui.write(_("http authorization required for %s\n") %
                           util.hidepassword(bytes(u)))
-            self.ui.write(_("realm: %s\n") % realm)
+            self.ui.write(_("realm: %s\n") % pycompat.bytesurl(realm))
             if user:
                 self.ui.write(_("user: %s\n") % user)
             else:
@@ -424,8 +424,8 @@ 
         user, pw = self.passwd.find_user_password(
             realm, urllibcompat.getfullurl(req))
         if pw is not None:
-            raw = "%s:%s" % (user, pw)
-            auth = 'Basic %s' % base64.b64encode(raw).strip()
+            raw = "%s:%s" % (pycompat.bytesurl(user), pycompat.bytesurl(pw))
+            auth = r'Basic %s' % pycompat.strurl(base64.b64encode(raw).strip())
             if req.get_header(self.auth_header, None) == auth:
                 return None
             self.auth = auth
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -143,6 +143,7 @@ 
 test-histedit-outgoing.t
 test-histedit-templates.t
 test-http-branchmap.t
+test-http-bundle1.t
 test-http-clone-r.t
 test-identify.t
 test-imports-checker.t