Skip to content

Disable HTTP/2 fallback when using -pr http11 flag#2392

Open
MAVRICK-1 wants to merge 1 commit intoprojectdiscovery:devfrom
MAVRICK-1:fix/disable-http2-fallback
Open

Disable HTTP/2 fallback when using -pr http11 flag#2392
MAVRICK-1 wants to merge 1 commit intoprojectdiscovery:devfrom
MAVRICK-1:fix/disable-http2-fallback

Conversation

@MAVRICK-1
Copy link

@MAVRICK-1 MAVRICK-1 commented Feb 4, 2026

Proposed changes

Fixes -pr http11 flag being ignored due to HTTP/2 fallback in retryablehttp-go.

When using -pr http11, httpx disables HTTP/2 at transport level but retryablehttp-go automatically falls back to HTTP/2 client on certain errors. This PR sets DisableHTTP2Fallback = true when http11 mode is enabled.

Depends on: projectdiscovery/retryablehttp-go#522

Proof

image image

Shows HTTP/1.1 only, no HTTP/2 fallback on malformed response errors.

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Fixes #2240
/claim #2240

Summary by CodeRabbit

  • Bug Fixes
    • Fixed HTTP protocol handling to properly disable HTTP/2 fallback when HTTP/1.1-only mode is enabled.

@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Walkthrough

Adds logic to disable HTTP/2 fallback in retryablehttp when HTTP/1.1-only protocol mode is selected in httpx. This ensures that when users explicitly request HTTP/1.1, the client respects that choice instead of automatically falling back to HTTP/2 on connection errors.

Changes

Cohort / File(s) Summary
HTTP/2 Fallback Suppression
common/httpx/httpx.go
Adds conditional to disable HTTP/2 fallback in retryablehttp when protocol is set to "http11", preventing unintended protocol switches when HTTP/1.1-only mode is explicitly configured.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through protocols fair,
Where HTTP/1.1 rules the air,
No more fallback tricks to play,
Just one true path to save the day! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: disabling HTTP/2 fallback when the -pr http11 flag is used.
Linked Issues check ✅ Passed The PR successfully implements the required fix by setting DisableHTTP2Fallback = true when HTTP/1.1 mode is enabled, directly addressing issue #2240.
Out of Scope Changes check ✅ Passed All changes are focused on disabling HTTP/2 fallback for HTTP/1.1 mode; no unrelated modifications were introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 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.

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.

-pr http11 flag is ignored on retryablehttp-go due to HTTP/2 fallback

1 participant