fix(http2): wire custom HTTP/2 fingerprints to the transport - #61
Merged
Conversation
The http2_fingerprint option was parsed but never actually emitted on the wire. The old HTTP2Fingerprint.Apply only wrote Transport.Settings, which fhttp's Transport.ApplyPreset immediately overwrote with hardcoded Firefox/ Chrome defaults derived from the User-Agent. The fhttp HTTP2Settings struct (ConnectionFlow, PriorityFrames, HeaderPriority, and Settings) was left empty, so connection flow, initial priority frames, and the HEADERS stream ID stayed driven by the UA regardless of the supplied fingerprint. Rewrite HTTP2Fingerprint parsing to match the canonical SETTINGS|WINDOW_UPDATE|PRIORITY_FRAMES|PSEUDO_HEADERS format and populate http2.HTTP2Settings. Apply that to the transport and use the fingerprint to pick the remaining fhttp defaults (e.g. the implicit HEADERS stream ID when no priority frames are present). Also map the pseudo-header order letters onto http.PHeaderOrderKey so the request header ordering matches the fingerprint too. This makes http2_fingerprint a first-class option and lets profiles that ship both ja4r and http2_fingerprint produce a coherent TLS + HTTP/2 identity.
smeinecke
force-pushed
the
fix-http2-fingerprint
branch
from
August 31, 2026 13:30
20719c9 to
1425119
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
http2_fingerprintso the supplied HTTP/2 identity is actually emitted on the wire.golang/http2.goto parse the canonicalSETTINGS|WINDOW_UPDATE|PRIORITY_FRAMES|PSEUDO_HEADERSformat and populatefhttp'shttp2.HTTP2Settings.golang/roundtripper.goto apply those settings to the transport and to set the pseudo-header order from the fingerprint.Background
The Go layer parsed
http2_fingerprintbut only assigned it tohttp2.Transport.Settings. That field is overwritten byTransport.ApplyPreset, which derives the real HTTP/2 frame profile from theNavigator(parsed from the User-Agent). As a result, every request was emitted with the default Firefox- or Chrome-style frame sequence regardless of the suppliedhttp2_fingerprint.What changed
HTTP2Fingerprintnow carries the full fingerprint:Settingsfrom the first partConnectionFlowfrom the second partPriorityFramesfrom the third partHeaderPriority(reserved for future use)PriorityOrderpseudo-header map from the fourth partApplysetshttp2.Transport.HTTP2Settingsinstead of justSettings.roundTripperparses the fingerprint once and uses it when creating thehttp2.Transportand when preparing each request (http.PHeaderOrderKey).HTTP2Fingerprint.Navigator()infers the minimal fhttp browser default needed for the implicit HEADERS stream ID when no explicit priority frames are present.Test plan
go test ./...ingolang/passes.libcycletlsand verified with the matrix of Firefox/Chrome/Edge/customhttp2_fingerprintstrings that the wire Akamai fingerprint now matches the supplied value.firefox_124_win,chrome_149_*) now produce coherent HTTP/2 frames.m,p,a,svsm,a,s,p) follows the fingerprint, not just the User-Agent.Notes
This does not change how
ja3/ja4rTLS fingerprints are handled; it only makeshttp2_fingerprintan independent, working lever. Profiles that already ship bothja4randhttp2_fingerprintnow produce a matching TLS + HTTP/2 identity.