Skip to content

Fix reduced timeouts being used for HTTP requests when a proxy URL is configured#6416

Merged
rickvdl merged 2 commits into
mainfrom
rickvdl/fix-http-request-timeout-when-using-proxy-url
Mar 9, 2026
Merged

Fix reduced timeouts being used for HTTP requests when a proxy URL is configured#6416
rickvdl merged 2 commits into
mainfrom
rickvdl/fix-http-request-timeout-when-using-proxy-url

Conversation

@rickvdl

@rickvdl rickvdl commented Mar 6, 2026

Copy link
Copy Markdown
Member

Summary

  • When a proxy URL is configured, fallback URLs are disabled. However, the timeout manager still applied the aggressive 5s/2s timeouts meant for endpoints with fallback support.
  • This caused proxy requests to time out with no fallback recovery path, making the proxy unusable for slow connections.
  • Added hasProxyURL parameter to the timeout manager so it uses the default timeout when a proxy is active.

Test plan

  • Added testUsesDefaultTimeoutForFallbackSupportingEndpointWhenProxyURLIsSet — verifies default timeout is used for fallback-supporting endpoints when proxy is set
  • Added testDoesNotUseReducedTimeoutAfterTimeoutWhenProxyURLIsSet — verifies reduced timeout is not applied after a prior timeout when proxy is set
  • All 155 existing HTTPClient/timeout tests pass

Note

Medium Risk
Touches core HTTP request timeout selection logic; incorrect conditions could change timeout behavior and affect request reliability, though the behavior change is scoped to when SystemInfo.proxyURL is set.

Overview
Prevents the dynamic timeout manager from applying aggressive (5s/2s) timeouts when a proxy URL is configured and fallback URLs are therefore unavailable.

This updates the timeout manager API to take fallbackAvailable (instead of a path) and wires HTTPClient to pass supportsFallbackURLs && SystemInfo.proxyURL == nil, plus adds unit coverage ensuring proxy-based requests use the default timeout even after prior main-backend timeouts.

Written by Cursor Bugbot for commit ddf792d. This will update automatically on new commits. Configure here.

@rickvdl rickvdl added the pr:fix A bug fix label Mar 6, 2026
@rickvdl rickvdl changed the title Fix HTTP timeout manager using reduced timeouts when proxy URL is configured Fix reduced timeouts being used for HTTP requests when a proxy URL is configured Mar 6, 2026
@rickvdl rickvdl marked this pull request as ready for review March 6, 2026 15:50
@rickvdl rickvdl requested a review from a team as a code owner March 6, 2026 15:50
rickvdl added 2 commits March 6, 2026 16:51
…RL is set

When a proxy URL is configured, fallback URLs are disabled. However, the
timeout manager still applied the aggressive 5s/2s timeouts meant for
endpoints with fallback support. This caused proxy requests to time out
with no fallback recovery path, making the proxy unusable for slow connections.
Move the fallback availability check (supportsFallbackURLs && no proxy)
to the caller, simplifying the timeout manager interface.
@rickvdl rickvdl force-pushed the rickvdl/fix-http-request-timeout-when-using-proxy-url branch from bfd6b9c to ddf792d Compare March 6, 2026 15:51

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!! 🫶

@ajpallares ajpallares left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Nice catch!

@rickvdl rickvdl merged commit 73c5534 into main Mar 9, 2026
39 checks passed
@rickvdl rickvdl deleted the rickvdl/fix-http-request-timeout-when-using-proxy-url branch March 9, 2026 07:47
github-merge-queue Bot pushed a commit to RevenueCat/purchases-android that referenced this pull request Mar 9, 2026
… configured (#3188)

## Summary

- When a proxy URL is configured, fallback URLs are disabled
(`AppConfig.fallbackBaseURLs` is empty). However, the timeout manager
still applied the aggressive 5s/2s timeouts meant for endpoints with
fallback support.
- This caused proxy requests to time out with no fallback recovery path,
making the proxy unusable for slow connections.
- Added `hasProxyURL` parameter to
`HTTPTimeoutManager.getTimeoutForRequest()` so it uses the default
timeout when a proxy is active.

**Related PR:** RevenueCat/purchases-ios#6416

## Test plan

- [x] Added `getTimeoutForRequest returns DEFAULT_TIMEOUT_MS for
fallback-supporting endpoint when proxy URL is set`
- [x] Added `getTimeoutForRequest returns DEFAULT_TIMEOUT_MS after
timeout when proxy URL is set`
- [x] All 17 existing HTTPTimeoutManager tests pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants