mirror of
https://github.com/git/git.git
synced 2026-11-25 17:15:30 +01:00
Git's existing retry logic only covers HTTP GET requests. However, the
actual data transfer during fetch and clone, as well as on-demand blob
downloads in partial clones, are sent as HTTP POST requests via
post_rpc(), which only retries authentication and immediately aborts on
429 or 5xx.
Extract the retry wait logic from http_request_recoverable() into a
shared http_retry_wait() helper and use it in post_rpc() to retry
transient HTTP errors for read-only services ("git-upload-pack" and
"git-upload-archive"). Do not retry "git-receive-pack" (git push), since
retrying a push POST after a 502 or 504 is not safe if the remote
already processed the request. Also defer reporting RPC errors until
retries are exhausted, and re-attach the "Content-Encoding: gzip" header
when retrying a compressed request.
Signed-off-by: Ravi Mistry <rmistry@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>