The bug seems to be triggered by lots of http requests on a pull/incoming operation, so it's a bit hard to create a minimal test case; I'm attaching a full bundle of the repo reconstructed with debugdag + debugbuilddag. To reproduce: - serve that repo behind http authentication; - clone it at revision 364; - run 'hg incoming'. Bisect points to: http://hg.intevation.org/mercurial/crew/rev/a1e575b48563
Reproduced on https://bitbucket.org/wbruna/test-http-auth The problem is that the HTTPDigestAuthHandler instance is reused for several requests in the discover phase, so we have to reset the retry counter at some time. The hack in a1e575b48563 didn't consider that. The attached patch works for me, but wbruna has some problems - perhaps related to proxy or something else ...
Unfortunately, that bitbucket repository needs to be private, so I need to whitelist all users. But I created a public test server with the same configuration (Apache, mod_wsgi, basic auth) as the real repository: hg clone -r clonehere http://test:test@hgtest.imescos.net/test-http-auth cd test-http-auth hg incoming -l 10
issue2255fix.diff works for me with Debian stable python version (2.5.2), but still fails with the python version currently in testing (2.6.5). We noticed the packaged version differs a bit from upstream; I'll test with a local installation.
kiilerix, does import urllib2;hasattr(urllib2.AbstractBasicAuthHandler(),'retried') returns True for your Python 2.6.5 install? (the version from Debian does; apparently most (including the 2.6.5 Python souce tarball) don't...).
The attached patch issue2255fix-basicauth.diff, on top of issue2255fix.diff, works for me, for both 2.5.2 and 2.6.5.
This was also reported on Debian: http://bugs.debian.org/586907 But I'm not sure if my patch is appropriate as is, it looks too much dependant on specific urllib behavior.
wbruna, do you agree that issue2299 is a duplicate of this? (I didn't have a clear memory of this issue and couldn't find it when I looked for it...) And for the record: The answer to the question in msg12910 is False for Fedora 13. The bogus retry handling in AbstractBasicAuthHandler has only been backported in Debian & co.
Yes, issue2299 looks the same to me.
To summarize: The first patch was applied for 1.6 (http://selenic.com/repo/hg/rev/2ec346160783), and solves this issue for http digest authentication; If import urllib2;hasattr(urllib2.AbstractBasicAuthHandler(),'retried') returns True (Python 2.6.5 + some 2.6.6 changes, as distributed by some Linux distros), a fix like proposed on issue2255fix-basicauth.diff is still needed for http basic (non-digest) authentication.
Fixed by http://hg.intevation.org/mercurial/crew/rev/6c51a5056020 Wagner Bruna <wbruna@softwareexpress.com.br> http basic auth: reset redirect counter on new requests (issue2255)
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:10 EDT --- This bug was previously known as _bug_ 2255 at http://mercurial.selenic.com/bts/issue2255 Imported an attachment (id=1418) Imported an attachment (id=1419) Imported an attachment (id=1420)