Skip to content

gh-53907: Reset the digest auth retry count when authentication fails#153646

Open
soreavis wants to merge 3 commits into
python:mainfrom
soreavis:digest-auth-retry-reset
Open

gh-53907: Reset the digest auth retry count when authentication fails#153646
soreavis wants to merge 3 commits into
python:mainfrom
soreavis:digest-auth-retry-reset

Conversation

@soreavis

@soreavis soreavis commented Jul 13, 2026

Copy link
Copy Markdown

HTTPDigestAuthHandler.http_error_401() resets the retry count only when http_error_auth_reqed() returns normally. It doesn't when it raises — and it raises once the count passes 5. The count stays set, so every later request through the same handler fails straight away with digest auth failed, even with valid credentials.

Reset it in a finally block so it runs on every exit path. ProxyDigestAuthHandler.http_error_407() had the same bug.

#53907

… fails

HTTPDigestAuthHandler.http_error_401() resets the retry count only when
http_error_auth_reqed() returns normally.  It doesn't when it raises --
and it raises once the count passes 5.  The count stays set, so every
later request through the same handler fails straight away with "digest
auth failed", even with valid credentials.

Reset it in a finally block so it runs on every exit path.
ProxyDigestAuthHandler.http_error_407() had the same bug.
@python-cla-bot

python-cla-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant