Skip to content

Preserve prepared requests on HTTP/2 fallback - #1341

Draft
quinnj wants to merge 1 commit into
masterfrom
jq/preserve-trace-on-auto-fallback
Draft

Preserve prepared requests on HTTP/2 fallback#1341
quinnj wants to merge 1 commit into
masterfrom
jq/preserve-trace-on-auto-fallback

Conversation

@quinnj

@quinnj quinnj commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Reuse the prepared request when automatic HTTP/2 negotiation falls back to HTTP/1.1.
  • Preserve trace-time header and body mutations, including cloud request signatures.
  • Add a TLS regression test that signs the request from RequestEvent and verifies that the HTTP/1.1 server receives the signature.

Root cause

_do_incoming! created and traced a send request before it tried HTTP/2. When ALPN selected HTTP/1.1, the fallback path discarded that prepared request and copied the unchanged source request again. The second copy lost all changes made after the first copy, including trace-time signing and cookie insertion.

The ALPN failure happens during connection setup. No HTTP request body has been sent or consumed at that point. The fallback can safely send the already prepared request.

User impact

Callers can keep HTTP.jl's default protocol=:auto behavior. Authenticated clients no longer need to force HTTP/1.1 to keep trace-time request signatures on fallback.

Validation

  • Confirmed the new regression test fails on HTTP.jl 2.6.0 because the server receives no Authorization header.
  • Confirmed the regression test passes after the fix.
  • Ran Pkg.test() on Julia 1.12.6. The full HTTP.jl suite passed, including all 63 trim-compile checks.
  • GitHub Actions CI run 1675 is green on stable and prerelease Julia across Linux and Windows, stable Julia on macOS ARM64, and documentation. The macOS job passed on rerun after an unrelated raw HTTP/1 first-byte timeout.

Co-authored by Codex

Reuse the prepared request when automatic HTTP/2 negotiation falls back to HTTP/1.1. This preserves trace-time signing and other mutations made after the request copy was created.

Cover the TLS fallback path with a trace-added Authorization header.
@quinnj
quinnj force-pushed the jq/preserve-trace-on-auto-fallback branch from 6a58e12 to a31ef60 Compare July 29, 2026 22:07
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.32%. Comparing base (ed8303c) to head (a31ef60).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1341      +/-   ##
==========================================
+ Coverage   88.30%   88.32%   +0.01%     
==========================================
  Files          30       30              
  Lines       11916    11915       -1     
==========================================
+ Hits        10523    10524       +1     
+ Misses       1393     1391       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant