[Python-apps-commits] r5929 - in packages/mercurial/trunk/debian (2 files)

vicho-guest at users.alioth.debian.org vicho-guest at users.alioth.debian.org
Wed Jul 28 12:01:56 UTC 2010


    Date: Wednesday, July 28, 2010 @ 12:01:31
  Author: vicho-guest
Revision: 5929

Added a patch to fix #586907

Added:
  packages/mercurial/trunk/debian/patches/from_upstream__issue2255fix-basicauth.diff
Modified:
  packages/mercurial/trunk/debian/changelog

Modified: packages/mercurial/trunk/debian/changelog
===================================================================
--- packages/mercurial/trunk/debian/changelog	2010-07-28 11:59:33 UTC (rev 5928)
+++ packages/mercurial/trunk/debian/changelog	2010-07-28 12:01:31 UTC (rev 5929)
@@ -1,6 +1,8 @@
 mercurial (1.6-3) UNRELEASED; urgency=low
 
   * Dropped build-depend on quilt (Closes: #588671)
+  * Added a patch from upstream that works around a bug in python 2.6.5
+	(Closes: #586907)
 
  -- Javi Merino <cibervicho at gmail.com>  Wed, 28 Jul 2010 13:10:44 +0200
 

Added: packages/mercurial/trunk/debian/patches/from_upstream__issue2255fix-basicauth.diff
===================================================================
--- packages/mercurial/trunk/debian/patches/from_upstream__issue2255fix-basicauth.diff	                        (rev 0)
+++ packages/mercurial/trunk/debian/patches/from_upstream__issue2255fix-basicauth.diff	2010-07-28 12:01:31 UTC (rev 5929)
@@ -0,0 +1,43 @@
+Patch proposed in http://mercurial.selenic.com/bts/issue2255 to fix bug #586907
+
+This file was downloaded from:
+http://mercurial.selenic.com/bts/file1106/issue2255fix-basicauth.diff
+
+diff --git a/mercurial/url.py b/mercurial/url.py
+--- a/mercurial/url.py
++++ b/mercurial/url.py
+@@ -570,6 +570,25 @@
+                 return
+             raise
+ 
++class httpbasicauthhandler(urllib2.HTTPBasicAuthHandler):
++    def __init__(self, *args, **kwargs):
++        urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
++        self.retried_req = None
++
++    def reset_retry_count(self):
++        # Python 2.6.5 will call this on 401 or 407 errors and thus loop
++        # forever. We disable reset_retry_count completely and reset in
++        # http_error_auth_reqed instead.
++        pass
++
++    def http_error_auth_reqed(self, auth_header, host, req, headers):
++        # Reset the retry counter once for each request.
++        if req is not self.retried_req:
++            self.retried_req = req
++            self.retried = 0
++        return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(
++                        self, auth_header, host, req, headers)
++
+ def getauthinfo(path):
+     scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
+     if not urlpath:
+@@ -615,7 +634,7 @@
+         ui.debug('http auth: user %s, password %s\n' %
+                  (user, passwd and '*' * len(passwd) or 'not set'))
+ 
+-    handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr),
++    handlers.extend((httpbasicauthhandler(passmgr),
+                      httpdigestauthhandler(passmgr)))
+     handlers.extend([h(ui, passmgr) for h in handlerfuncs])
+     opener = urllib2.build_opener(*handlers)




More information about the Python-apps-commits mailing list