fix: do not re-attempt https after the scheme fallback - #2583
Draft
knakul853 wants to merge 1 commit into
Draft
Conversation
The HTTP 400 upgrade did not check whether https had already been tried. When the scheme heuristic probes https first, that attempt fails, the error fallback switches to http, and the plaintext service answers 400, the upgrade retried the same https endpoint a second time - costing up to a full -timeout against a host that accepts the TLS connection and never replies. Claude-Session: https://claude.ai/code/session_015AKXsNzjd3HjGMq4B8JCNH Claude-Local-Session: claude --resume 0fe5b680-5ba5-43e6-b354-43d4388aaf9c
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
The HTTP 400 upgrade added in #2577 did not check whether https had already been attempted. When the scheme heuristic probes https first (bare host, or a port <=1024 other than 80/8080), that attempt fails, the pre-existing error fallback switches to http, and the plaintext service answers 400, the upgrade retried the same https endpoint a second time.
!retried, so the fallback's already-failed https attempt is not repeated.Trade-off taken deliberately:
!retriedalso suppresses https-on-port-80 after an https:443failure rewrites the target to:80. Judged not worth the extra state to preserve; happy to revisit.Evidence
Test fails without the guard (2 attempts, "the same https endpoint must not be attempted twice"), passes with it - patch removal asserted, so the control is real.
All 5 upgrade/retention tests pass under
-race; full runner suite green; integration 21/21 across 3 runs on this branch and ondev.Cost measured: 0.90s vs 2.81s locally, up to a full
-timeout(10.11s at-timeout 10) against a host that accepts the TLS connection and never replies.Still open
Claude-Session: https://claude.ai/code/session_015AKXsNzjd3HjGMq4B8JCNH
Claude-Local-Session: claude --resume 0fe5b680-5ba5-43e6-b354-43d4388aaf9c