Skip to content

Comments

fix(httpx): enforce http11 for both fallback and h2 probe clients#1

Open
wh0amibjm wants to merge 3 commits intocococlaw:fix/algora-2240-http11-no-h2-fallbackfrom
wh0amibjm:fix/algora-2240-http11-no-h2-fallback-followup
Open

fix(httpx): enforce http11 for both fallback and h2 probe clients#1
wh0amibjm wants to merge 3 commits intocococlaw:fix/algora-2240-http11-no-h2-fallbackfrom
wh0amibjm:fix/algora-2240-http11-no-h2-fallback-followup

Conversation

@wh0amibjm
Copy link

@wh0amibjm wh0amibjm commented Feb 20, 2026

Follow-up for projectdiscovery#2414 to address review feedback.

Proposed Changes

  • In common/httpx/httpx.go, when Protocol == http11:
    • set retryablehttp.Client.HTTPClient2 = HTTPClient
    • set httpx.client2 = httpx.client.HTTPClient
      This ensures both retry fallback and HTTP/2 probe paths honor explicit HTTP/1.1 mode.
  • Keep http2.Transport-backed client2 only for non-http11 modes.
  • Extend tests in common/httpx/httpx_protocol_test.go to verify:
    • http11 mode uses the same client for HTTPClient, HTTPClient2, and client2
    • non-http11 mode keeps dedicated HTTP/2 client
    • dialer resources are closed via t.Cleanup.

Proof

Before (origin/dev), with the same test file:

go test ./common/httpx -run TestNew_HTTP11DisablesRetryableHTTP2Fallback -count=1
# FAIL: HTTPClient2 was not same as HTTPClient in http11 mode

After:

go test ./common/httpx -run TestNew_ -count=1
# ok

Checklist:

  • PR created against correct branch
  • Tests added for behavior
  • Local tests passing for affected package

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants