Skip to content

Conversation

@gunir
Copy link

@gunir gunir commented Dec 5, 2025

This add new feature to tls-client to be able to configure AllowHTTP and StreamID, there's 2 ways to set:

profiles.NewClientProfile(
		clientHelloId,
		settings,
		settingsOrder,
		pseudoHeaderOrder,
		connectionFlow,
		nil,     // <--- CHANGED: Pass the priorities slice here
		headerPriority,
		3,
		false,
	)

Or:

	options := []tls_client.HttpClientOption{
		tls_client.WithTimeoutSeconds(60),
		tls_client.WithClientProfile(MyCustomFirefoxProfile), 
		tls_client.WithInitialStreamID(3),
	}

This is useful because Firefox 147's HTTP Frame use stream_id = 3 instead of 1, completely match Firefox Fingerprint instead of nearly matching it:
https://tls.peet.ws/api/all

  "http2": {
    "akamai_fingerprint": "1:65536;2:0;4:131072;5:16384|12517377|0|m,p,a,s",
    "akamai_fingerprint_hash": "6ea73faa8fc5aac76bded7bd238f6433",
    "sent_frames": [
      {
        "frame_type": "SETTINGS",
        "length": 24,
        "settings": [
          "HEADER_TABLE_SIZE = 65536",
          "ENABLE_PUSH = 0",
          "INITIAL_WINDOW_SIZE = 131072",
          "MAX_FRAME_SIZE = 16384"
        ]
      },
      {
        "frame_type": "WINDOW_UPDATE",
        "length": 4,
        "increment": 12517377
      },
      {
        "frame_type": "HEADERS",
        "stream_id": 3,
        "length": 279,
        "headers": [
          ":method: GET",
          ":path: /api/all",
          ":authority: tls.peet.ws",
          ":scheme: https",
          "user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0",
          "accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
          "accept-language: en-US,en;q=0.5",
          "accept-encoding: gzip, deflate, br, zstd",
          "upgrade-insecure-requests: 1",
          "sec-fetch-dest: document",
          "sec-fetch-mode: navigate",
          "sec-fetch-site: none",
          "sec-fetch-user: ?1",
          "priority: u=0, i",
          "te: trailers"
        ],
        "flags": [
          "EndStream (0x1)",
          "EndHeaders (0x4)",
          "Priority (0x20)"
        ],
        "priority": {
          "weight": 42,
          "depends_on": 0,
          "exclusive": 0
        }
      }
    ]
  },

This PR depends on another PR bogdanfinn/fhttp#15 from https://github.com/gunir/fhttp-allowhttp-streamid/tree/fhttp-streamid-fixsmallwindowsizehangfirefox

gunir added 5 commits December 5, 2025 09:01
Add extra params to NewClientProfile
Add extra logics to expose AllowHTTP and StreamID
Add extra logics to expose AllowHTTP and StreamID
Add extra logics to expose AllowHTTP and StreamID
Add extra logics to expose AllowHTTP and StreamID
@gunir gunir changed the title Allowhttp streamid fixwindowsizefirefox Add AllowHTTP, set StreamID value Dec 5, 2025
gunir added 2 commits December 5, 2025 11:27
Update internal_browser_profiles.go - Back to previous state
Add extra params to NewClientProfile to be compatible with new changes
Copy link
Author

@gunir gunir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong file, should be internal_custom_profiles.go

@bogdanfinn
Copy link
Owner

@gunir it looks like you mixed up the roundtripper file and the client_options file here?

@gunir
Copy link
Author

gunir commented Dec 28, 2025

@gunir it looks like you mixed up the roundtripper file and the client_options file here?

Oh I see the roundtripper

Fix to use the right roundtripper.go file with all the new features
@gunir
Copy link
Author

gunir commented Dec 28, 2025

There will be some other improvement I will make in the next few days to improve the window size logics

Copy link
Owner

@bogdanfinn bogdanfinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition it seems like you are not using AllowHTTP at all right?

Update client.go - Remove redundant params
Update roundtripper.go - remove redundant params
@gunir
Copy link
Author

gunir commented Dec 29, 2025

In addition it seems like you are not using AllowHTTP at all right?

Yeah, AllowHTTP is just a duplicate way to set initialStreamID to 3, just to fully mimic Firefox, if you don't want allowHTTP I will remove it
Ideally, profiles.NewClientProfile should be able to set initialStreamID, just for Firefox profile to be able to be 3 and achieve fully Firefox's HTTP2 Fingerprint

@gunir gunir requested a review from bogdanfinn December 29, 2025 14:52
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