Skip to content

fix: disable HTTP/2 fallback when -pr http11 is set#2409

Closed
285729101 wants to merge 3 commits intoprojectdiscovery:mainfrom
285729101:fix/http11-flag
Closed

fix: disable HTTP/2 fallback when -pr http11 is set#2409
285729101 wants to merge 3 commits intoprojectdiscovery:mainfrom
285729101:fix/http11-flag

Conversation

@285729101
Copy link

Summary

  • Override retryablehttp-go's internal HTTPClient2 fallback client with an HTTP/1.1-only transport when -pr http11 is explicitly specified
  • This prevents the library from silently falling back to HTTP/2 on malformed HTTP version errors, which was causing the -pr http11 flag to be ignored
  • The fix clones the existing HTTP/1.1 transport and sets TLSNextProto to an empty map to fully disable HTTP/2 negotiation on the fallback client

Test plan

  • Verify go build ./... compiles successfully
  • Verify go test ./common/httpx/... passes
  • Manual test: run httpx -u <target> -pr http11 against an HTTP/2 server and confirm only HTTP/1.1 is used
  • Manual test: confirm normal (non -pr http11) behavior is unaffected and HTTP/2 fallback still works

/claim #2240

🤖 Generated with Claude Code

dogancanbakir and others added 3 commits January 21, 2026 19:39
When the user explicitly requests HTTP/1.1 via the -pr http11 flag,
httpx correctly configures the primary transport to disable HTTP/2.
However, retryablehttp-go's internal HTTPClient2 (used as a fallback
on certain HTTP/1.x errors) still has HTTP/2 enabled, causing the
protocol preference to be silently ignored.

This fix overrides the retryablehttp fallback client (HTTPClient2)
with an HTTP/1.1-only transport when -pr http11 is specified, ensuring
the user's protocol preference is fully respected.

Fixes projectdiscovery#2240
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@285729101 285729101 force-pushed the fix/http11-flag branch 2 times, most recently from 7f1f86c to 0212fd7 Compare February 17, 2026 16:46
@285729101
Copy link
Author

@Ice3man543 alternative approach for the HTTP/1.1 flag fix — disables HTTP/2 at the transport level.

@dogancanbakir
Copy link
Member

Hi, thanks for your interest in contributing! Just a heads up, we ask contributors to work on 1 active issue at a time (see).

Also, we welcome AI-assisted development, but submissions must be complete, tested, and ready to merge. Please also make sure to fill out the PR template with proof that your changes work.

We're closing this PR along with your other open submissions. Once you're ready, feel free to pick one issue to focus on and resubmit; we'd be happy to review it.

Appreciate your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments