[PATCH] http push: break infinite recursion on failure with Python 2.6.5 (issue2179)

Augie Fackler durin42 at gmail.com
Fri Jun 18 00:21:57 CDT 2010


On Jun 16, 2010, at 3:56 PM, Mads Kiilerich wrote:

> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1276721698 -7200
> # Node ID 3d23e7ababac71323b7704a84a62a8af56f95f1c
> # Parent  fcc7cf0d814a769486a46d82bb5f3ee15008051f
> http push: break infinite recursion on failure with Python 2.6.5 (issue2179)
> 
> Python 2.6.5 will keep resetting the retry count on redirects, for example when
> the server returns 401 on failing auth (like google code currently does). We
> stop the endless recursion by not resetting the count.
> 
> http://bugs.python.org/issue3819 introduced the regression with Python 2.6.5.
> 
> http://bugs.python.org/issue8797 discusses a fix which might make it to 2.6.6
> and 2.7.0.
> 
> diff --git a/mercurial/url.py b/mercurial/url.py
> --- a/mercurial/url.py
> +++ b/mercurial/url.py
> @@ -556,6 +556,13 @@
>                 return
>             raise
> 
> +    # Python 2.6.5 will keep resetting the retry count on redirects, for
> +    # example when the server returns 401 on failing auth (like google code
> +    # currently does). We stop the endless recursion by not resetting the
> +    # count.
> +    def reset_retry_count(self):
> +        pass
> +

I'm not a particular expert with respect to urllib2 (yet?), but this seems reasonable to me and makes sense in my mind for inclusion in 1.6, especially if Henrik agrees.

It's also worth noting the only server that tickles this bug is Google Code, and I'm planning on fixing that as soon as I get a spare minute, so it probably isn't a disaster if we leave it out.

> def getauthinfo(path):
>     scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
>     if not urlpath:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list