Skip to content

Navigation Menu

Sign up

ngclient: retry transient 502/503/504 responses in Urllib3Fetcher - #3067

Open
ekanshbannsal wants to merge 1 commit into
theupdateframework:develop from
ekanshbannsal:fix/urllib3-retry-5xx
Open

ekanshbannsal wants to merge 1 commit into
theupdateframework:develop from
ekanshbannsal:fix/urllib3-retry-5xx

Conversation

@ekanshbannsal

@ekanshbannsal ekanshbannsal commented Nov 28, 2026

Copy link
Copy Markdown

Description of the changes being introduced by the pull request:

Urllib3Fetcher previously left urllib3's Retry(total=3) defaults in place, which keep status_forcelist=set(), so transient 502/503/504 responses without a Retry-After header (e.g. Google Cloud Storage-backed TUF repositories such as Sigstore) failed immediately without retrying.

  • Configured Urllib3Fetcher._fetch in tuf/ngclient/urllib3_fetcher.py to pass retries=urllib3.Retry(total=3, status_forcelist=frozenset({502, 503, 504}), raise_on_status=False) to ProxyEnvironment.request(...).
  • Keeping raise_on_status=False preserves existing Urllib3Fetcher error semantics so persistent 502/503/504 responses after retries are exhausted still raise exceptions.DownloadHTTPError with the HTTP status code.
  • Added unit tests in tests/test_fetcher_ng.py verifying that transient 502 -> 503 -> 504 -> 200 responses succeed after retries and that persistent 504 responses raise DownloadHTTPError(status_code=504) after exhausting retries.
  • Verified locally with python -m unittest, ruff check, ruff format --diff, and mypy.

Fixes #3044

Signed-off-by: Ekansh Bannsal <ekanshbannsal@gmail.com>
ekanshbannsal requested a review from a team as a code owner November 28, 2026 11:35

This branch has not been deployed

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

no retries on HTTP 5xx errors

1 participant

AltStyle によって変換されたページ (->オリジナル) /