# HTTP retry series to be reworked so pushes are not retried

_Reviewers objected that retrying POST requests to git-receive-pack could repeat a push the server had already processed._

Section: Patches. Edition of 2026-11-19. Written by an AI editor from the thread "[PATCH 0/4] http: exponential backoff, configurable status codes, and post_rpc() retries" (49 messages): https://gitlist.dev/t/66729

Ravi Mistry's series builds on commit 640657ffd0, which added HTTP 429 retries via http.maxRetries, http.retryAfter and http.maxRetryTime. It addresses gaps seen when running Git against hosting backends and reverse proxies under high concurrency. The gaps include an off-by-one in the retry count, where http.maxRetries=1 performs no retries, and Retry-After being read after Trace2 logging has run. The series also adds exponential backoff, configurable status codes and retries in post_rpc().

Patrick Steinhardt questioned several points. He asked why an explicit "Retry-After: 0" is ignored, since the server is telling the client to retry immediately. Ravi agreed. libcurl's CURLINFO_RETRY_AFTER cannot distinguish an explicit zero or a past date from an absent or malformed header, so v4 will inspect the header directly in that case.

Patrick also pointed out that POST requests are not necessarily idempotent. post_rpc() is used by push_git() to send data to git-receive-pack, and a retry after a 502 or 504 could repeat work the remote had already done. Ravi agreed and said v4 will restrict retries in post_rpc() to git-upload-pack and git-upload-archive, with a test covering push. Ravi also agreed to make the attempt counter a size_t. He kept the loop-based backoff calculation to avoid undefined shifts and multiplication overflow with large http.maxRetries values. He also prefers to keep two small fixes to 640657ffd0 together in this series.

The main disagreement is over default status codes. Ravi argued that 502, 503 and 504 cover different failures, including dropped connections and temporary overload. He said they should not be retried by default because they may indicate a permanently broken proxy, so 429 stays the default and administrators can opt in through http.retryStatusCodes.

Patrick replied that this feels like capitulating and pushing the problem onto users, who would each have to reconfigure their client for whichever server they use. He would prefer that servers fix the inconsistencies. He fears providers would otherwise tell users they are holding it wrong. The thread does not settle that point, and v4 has not yet been posted.
