feat: add DisableHTTP2Fallback option to prevent automatic HTTP/2 fallback#526
Closed
MrLawrenceKwan wants to merge 1 commit intoprojectdiscovery:mainfrom
Closed
feat: add DisableHTTP2Fallback option to prevent automatic HTTP/2 fallback#526MrLawrenceKwan wants to merge 1 commit intoprojectdiscovery:mainfrom
MrLawrenceKwan wants to merge 1 commit intoprojectdiscovery:mainfrom
Conversation
…lback This option allows clients to disable the automatic fallback to HTTP/2 when encountering malformed HTTP/2 errors. This is useful when a client explicitly wants to use HTTP/1.1 only and have errors handled according to the retry policy instead of automatically switching protocols. Fixes projectdiscovery/httpx#2240
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.
Description
This PR adds a new
DisableHTTP2Fallbackoption to the client Options struct, allowing clients to disable the automatic fallback to HTTP/2 when encountering malformed HTTP/2 errors.Context
This change is needed to fix projectdiscovery/httpx#2240, where the
-pr http11flag was being ignored because retryablehttp-go would automatically fallback to HTTP/2 on certain errors.Changes
Added
DisableHTTP2Fallbackfield to Options struct: When set totrue, the client will not automatically switch to HTTP/2 on malformed HTTP version errors.Updated
do.goto respect the option: The HTTP/2 fallback logic now checksc.options.DisableHTTP2Fallbackbefore attempting the fallback.Behavior
Use Case
This is particularly useful when clients explicitly want to use HTTP/1.1 only and prefer to handle errors according to the retry policy rather than automatically switching to HTTP/2.
Related Issues
Testing
This change has been tested with httpx and works correctly to enforce HTTP/1.1 when the protocol flag is set.