Skip to content

Retry a request whose proxy cannot be reached - #4

Open
levidurfee wants to merge 1 commit into
developmentfrom
fix/retry-proxy-connect
Open

levidurfee wants to merge 1 commit into
developmentfrom
fix/retry-proxy-connect

Conversation

@levidurfee

Copy link
Copy Markdown
Contributor

Defect

net/http reports a failed dial to a proxy as a *net.OpError with Op: "proxyconnect" wrapping the dial error. retryableErr used errors.As, which stops at the outer OpError, and compared Op with "dial" only. A request whose HTTPS proxy could not be reached was therefore treated as possibly sent.

Consequence

Calls retried only when the request certainly was not sent (CreateKey, CreateAPIToken, RotateKey, CreateContainer, and the other retryIfUnprocessed calls) failed after one attempt when the proxy was unreachable. The package documentation states that every request is retried after a failure to connect. The default client honours HTTPS_PROXY, so the path is reachable without WithHTTPClient.

Change

  • retryableErr treats Op == "proxyconnect" as a failure to connect. net/http applies that wrapper only to errors raised while setting up the connection to the proxy, before the request is written.
  • TestProxyDialErrorRetried points a transport at a closed proxy port and expects DefaultMaxAttempts attempts. The test fails on development with after 1 attempt and passes with the change.
  • CHANGELOG entry under Unreleased.

Checks

make check, go test -race, and staticcheck 2026.2.2 with -tags integration pass locally.


Generated by Claude Code

net/http reports a failed dial to a proxy as a "proxyconnect" *net.OpError
wrapping the dial error, and errors.As stopped at the outer one, so the
request was treated as possibly sent. Calls that are retried only when
the request certainly was not sent, such as CreateKey, then failed after
one attempt, against the package documentation's promise that a failure
to connect is always retried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NYjhaGqZtskW52B5CMxFQS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants