fix: set timeouts on the upstream HTTP client #83

Merged
benvin merged 2 commits from benvin/upstream-http-timeouts into master 2026-07-02 22:24:50 +10:00

2 Commits

Author SHA1 Message Date
unkinben 1e879126d7 feat: make upstream timeouts configurable per-remote
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
Keep the dial/TLS/response-header timeouts as defaults, but allow each
remote to override them via upstream_dial_timeout / upstream_tls_timeout /
upstream_response_header_timeout (seconds; 0 = default). Clients are cached
by their timeout set so remotes sharing a configuration also share a
connection pool.

Refs #67
2026-07-02 20:16:43 +10:00
unkinben 1476120c7b fix: use a timeout-configured HTTP client for upstream requests
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
All upstream GET/HEAD and bearer-token requests used http.DefaultClient,
which has no timeouts, so a slow or wedged upstream could pin a goroutine
and connection indefinitely. Introduce a shared upstreamClient with
dial, TLS-handshake and response-header timeouts (no overall Client
timeout, so large artifact bodies can still stream, bounded by the
request context).

Refs #67
2026-07-02 00:26:36 +10:00