feat: add DisableHTTP2Fallback option#524
feat: add DisableHTTP2Fallback option#524jpirstin wants to merge 2 commits intoprojectdiscovery:mainfrom
Conversation
…back When callers explicitly configure HTTP/1.1 only transport, the automatic fallback to HTTP/2 client on malformed HTTP version errors should be skippable. This adds a DisableHTTP2Fallback option that, when set to true, prevents the fallback to HTTPClient2. Fixes projectdiscovery/httpx#2240
…ehttp When using -pr http11, httpx configures the transport to disable HTTP/2 but retryablehttp-go's automatic fallback to HTTPClient2 on malformed HTTP version errors bypasses this setting. This sets the new DisableHTTP2Fallback option in retryablehttp-go when protocol is http11. Depends on: projectdiscovery/retryablehttp-go#524 Fixes projectdiscovery#2240
|
Hi team — just flagging that CI workflows are showing |
|
Friendly ping — this PR adds a |
|
Checking in on this PR — any feedback or CI gate changes needed to move it forward? Happy to rebase or adjust. Thanks! |
|
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. |
Summary
Adds a
DisableHTTP2Fallbackoption toOptionsstruct that, when set totrue, prevents the automatic fallback to HTTP/2 client (HTTPClient2) when the HTTP/1.x transport encounters malformed HTTP version errors.Problem
When callers (e.g., httpx with
-pr http11) explicitly configure HTTP/1.1-only transport by settingTLSNextPrototo an empty map, the fallback indo.gostill switches toHTTPClient2on certain errors, bypassing the caller's explicit protocol choice. This causes the-prflag in httpx to not work correctly.Solution
Added a boolean
DisableHTTP2Fallbackoption. When enabled, the HTTP/2 fallback path indo.gois skipped, and errors are handled according to the normal retry policy.Changes
client.go: AddedDisableHTTP2Fallback booltoOptionsstructdo.go: Guard the HTTP/2 fallback with!c.options.DisableHTTP2FallbackFixes projectdiscovery/httpx#2240