fix: respect -pr http11 flag by disabling HTTP/2 fallback#2407
fix: respect -pr http11 flag by disabling HTTP/2 fallback#2407jpirstin wants to merge 1 commit intoprojectdiscovery:devfrom
Conversation
…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
WalkthroughThe PR addresses HTTP/1.1 protocol enforcement by configuring Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@go.mod`:
- Around line 182-183: Remove the temporary replace directive that points to the
personal fork (the replace line referencing
github.com/jpirstin/retryablehttp-go) and instead update the require entry for
github.com/projectdiscovery/retryablehttp-go to the official released version
that contains the DisableHTTP2Fallback change from
projectdiscovery/retryablehttp-go#524; ensure the replace line is deleted and
the require version is bumped to the new tag once that release is available so
the code uses the upstream package with DisableHTTP2Fallback.
|
|
||
| replace github.com/projectdiscovery/retryablehttp-go => github.com/jpirstin/retryablehttp-go v1.3.7-0.20260216171522-ed815bc09ccf |
There was a problem hiding this comment.
Replace directive pointing to a personal fork must not be merged.
The replace directive to github.com/jpirstin/retryablehttp-go is appropriate for development/testing, but it must be removed before merging. Once projectdiscovery/retryablehttp-go#524 is released, update the require block (line 35) to the new version that includes DisableHTTP2Fallback and drop this replace.
🤖 Prompt for AI Agents
In `@go.mod` around lines 182 - 183, Remove the temporary replace directive that
points to the personal fork (the replace line referencing
github.com/jpirstin/retryablehttp-go) and instead update the require entry for
github.com/projectdiscovery/retryablehttp-go to the official released version
that contains the DisableHTTP2Fallback change from
projectdiscovery/retryablehttp-go#524; ensure the replace line is deleted and
the require version is bumped to the new tag once that release is available so
the code uses the upstream package with DisableHTTP2Fallback.
Summary
Fixes the
-pr http11flag being ignored due to HTTP/2 fallback in retryablehttp-go.Problem
As described in #2240, when httpx is run with
-pr http11, it configures the transport to disable HTTP/2 by settingTLSNextPrototo an empty map. However, retryablehttp-go'sdo.gohas a fallback that switches toHTTPClient2when it encountersmalformed HTTP version "HTTP/2"errors, effectively bypassing the explicit HTTP/1.1-only configuration.Solution
DisableHTTP2Fallbackoption toOptionsstruct that guards the HTTP/2 fallback path.DisableHTTP2Fallback = truewhenProtocol == "http11".Dependencies
This PR depends on projectdiscovery/retryablehttp-go#524 being merged first. The
go.modcurrently uses a replace directive pointing to my fork; once the retryablehttp-go PR is merged and released, the replace can be removed.Fixes #2240
Summary by CodeRabbit
Improvements
Chores