Skip to content

fix(bottlecap): thread flush_timeout into HTTP fallback client#1215

Draft
jchrostek-dd wants to merge 1 commit intomainfrom
john/http-fallback-flush-timeout
Draft

fix(bottlecap): thread flush_timeout into HTTP fallback client#1215
jchrostek-dd wants to merge 1 commit intomainfrom
john/http-fallback-flush-timeout

Conversation

@jchrostek-dd
Copy link
Copy Markdown
Contributor

Summary

  • The fallback path in get_client (bottlecap/src/http.rs) called reqwest::Client::new() when the configured proxy URI was unparseable, producing a client with no timeout — requests could block indefinitely regardless of flush_timeout.
  • Replaced the bare Client::new() with create_reqwest_client_builder().ok().and_then(|b| b.timeout(Duration::from_secs(config.flush_timeout)).build().ok()).unwrap_or_else(reqwest::Client::new) so the fallback client honours the configured timeout.
  • Removed the //TODO comment and added a unit test that forces the fallback via an unparseable proxy_https value.

Reviewer notes

  • The inner unwrap_or_else(reqwest::Client::new) is a last-resort safety net for the case where create_reqwest_client_builder() itself fails on a FIPS build; the pre-existing infinite-timeout behaviour is preserved only for that edge case.
  • Proxy / keepalive / HTTP2 / cert settings are intentionally omitted from the fallback builder — those settings are irrelevant when proxy parsing already failed.

🤖 Generated with Claude Code

The fallback in get_client used reqwest::Client::new() which carries no
timeout, allowing it to outlast the configured flush_timeout. Replace it
with create_reqwest_client_builder() + .timeout() so the fallback client
honours the same limit as the happy path. Inner unwrap_or_else(Client::new)
preserves the pre-existing behaviour only when the FIPS builder itself
fails.

Adds a unit test that forces the fallback via an unparseable proxy_https
value and asserts no panic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant