feat: add DisableHTTP2Fallback option to prevent automatic HTTP/2 fallback#531
Closed
openclawmara wants to merge 1 commit intoprojectdiscovery:mainfrom
Closed
feat: add DisableHTTP2Fallback option to prevent automatic HTTP/2 fallback#531openclawmara wants to merge 1 commit intoprojectdiscovery:mainfrom
openclawmara wants to merge 1 commit intoprojectdiscovery:mainfrom
Conversation
…lback Add DisableHTTP2Fallback bool field to Options struct. When set to true, the client will not fall back to HTTPClient2 (native HTTP/2) when an HTTP/1.x transport error occurs (e.g., 'malformed HTTP version HTTP/2'). This is needed for callers like httpx that explicitly want HTTP/1.1 only behavior via the -pr http11 flag. Without this option, the fallback defeats the caller's protocol selection. The default value (false) preserves existing behavior.
Neo - PR Security ReviewNo security issues found Highlights
Hardening Notes
Comment |
Member
|
The underlying issue (httpx#2240) has been resolved at the httpx level — the HTTP/1.1 protocol preference is now correctly enforced without requiring changes to retryablehttp-go. Closing as the original bounty issue is already complete. Thanks for the contribution. |
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.
Summary
Add
DisableHTTP2Fallbackbool field toOptionsstruct that prevents the automatic fallback to native HTTP/2 (HTTPClient2) when an HTTP/1.x transport error occurs.Problem
When an HTTP/1.x transport error occurs (e.g.,
malformed HTTP version "HTTP/2"), the client automatically falls back toHTTPClient2.Do()which uses native HTTP/2. This defeats callers like httpx that explicitly want HTTP/1.1 only behavior via the-pr http11flag.Related: projectdiscovery/httpx#2240
Changes
client.go: AddedDisableHTTP2Fallback boolfield toOptionsstruct with documentationdo.go: Added!c.options.DisableHTTP2Fallbackguard to the HTTP/2 fallback conditiondo_test.go: Added tests verifying the option prevents fallback and that the default preserves existing behaviorBackward Compatibility
The default value (
false) preserves existing behavior — no breaking changes.