diff --git a/Cargo.lock b/Cargo.lock index 110ae5c1..2fa2cd72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -245,9 +245,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.22.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" [[package]] name = "bitflags" @@ -1128,9 +1128,9 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "hyper" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" dependencies = [ "atomic-waker", "bytes", @@ -1142,7 +1142,6 @@ dependencies = [ "httparse", "itoa", "pin-project-lite", - "pin-utils", "smallvec", "tokio", "want", @@ -1166,8 +1165,8 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.20" -source = "git+https://github.com/apify/hyper-util?rev=9b7795dfd7158fc55e7c84b65bf1dae1d2dea67d#9b7795dfd7158fc55e7c84b65bf1dae1d2dea67d" +version = "0.1.21" +source = "git+https://github.com/apify/hyper-util?rev=401e6fb99bb6bd4956a0fafca39f4b7b37be8a0a#401e6fb99bb6bd4956a0fafca39f4b7b37be8a0a" dependencies = [ "base64", "bytes", @@ -1175,6 +1174,7 @@ dependencies = [ "futures-util", "http", "http-body", + "httparse", "hyper", "ipnet", "libc", @@ -2177,9 +2177,8 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" +version = "0.13.5" +source = "git+https://github.com/seanmonstar/reqwest?rev=2230ed3945fb2908692b88dad1dcd06db9fb2ca6#2230ed3945fb2908692b88dad1dcd06db9fb2ca6" dependencies = [ "base64", "bytes", @@ -2796,8 +2795,8 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.8" -source = "git+https://github.com/apify/tower-http?rev=f9efc0d9193e774d33aedc1022b922efefc22052#f9efc0d9193e774d33aedc1022b922efefc22052" +version = "0.7.1" +source = "git+https://github.com/apify/tower-http?rev=4d96dbd81f86559c38cf76b8ce671089544a26e3#4d96dbd81f86559c38cf76b8ce671089544a26e3" dependencies = [ "async-compression", "bitflags", @@ -2807,6 +2806,7 @@ dependencies = [ "http", "http-body", "http-body-util", + "percent-encoding", "pin-project-lite", "tokio", "tokio-util", diff --git a/Cargo.toml b/Cargo.toml index 05970f7c..ee54db2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,9 @@ members = [ [patch.crates-io] h2 = { git = "https://github.com/apify/h2", rev = "7f393a728a8db07cabb1b78d2094772b33943b9a" } rustls = { git = "https://github.com/apify/rustls", rev="b158c57cf02dcae81c11a73389c599269bb74621" } -tower-http = { git = "https://github.com/apify/tower-http", rev="f9efc0d9193e774d33aedc1022b922efefc22052" } -hyper-util = { git = "https://github.com/apify/hyper-util", rev="9b7795dfd7158fc55e7c84b65bf1dae1d2dea67d" } +tower-http = { git = "https://github.com/apify/tower-http", rev="4d96dbd81f86559c38cf76b8ce671089544a26e3" } +hyper-util = { git = "https://github.com/apify/hyper-util", rev="401e6fb99bb6bd4956a0fafca39f4b7b37be8a0a" } +reqwest = { git = "https://github.com/seanmonstar/reqwest", rev="2230ed3945fb2908692b88dad1dcd06db9fb2ca6" } [profile.release] strip = true # Automatically strip symbols from the binary. diff --git a/impit/src/fingerprint/database/chrome.rs b/impit/src/fingerprint/database/chrome.rs index 4fb5c675..55dfc332 100644 --- a/impit/src/fingerprint/database/chrome.rs +++ b/impit/src/fingerprint/database/chrome.rs @@ -137,6 +137,8 @@ pub mod chrome_151 { // 15663105, which is what the capture shows on the wire. initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -276,8 +278,10 @@ pub mod chrome_142 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -417,8 +421,10 @@ pub mod chrome_136 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -552,8 +558,10 @@ pub mod chrome_133 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -687,8 +695,10 @@ pub mod chrome_124 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -825,8 +835,10 @@ pub mod chrome_131 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -957,8 +969,10 @@ pub mod chrome_100 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: Some(1_000), } } @@ -1057,7 +1071,7 @@ pub mod chrome_107 { "Chrome", "107", chrome_100::tls_fingerprint(), - chrome_100::http2_fingerprint(), // TODO Chrome 107 uses different HTTP/2 settings + chrome_100::http2_fingerprint(), headers(), ) } @@ -1090,7 +1104,7 @@ pub mod chrome_110 { "Chrome", "110", chrome_100::tls_fingerprint(), - chrome_100::http2_fingerprint(), // TODO Chrome 110 uses different HTTP/2 settings + chrome_100::http2_fingerprint(), headers(), ) } @@ -1123,7 +1137,7 @@ pub mod chrome_116 { "Chrome", "116", chrome_100::tls_fingerprint(), - chrome_100::http2_fingerprint(), // TODO Chrome 116 uses different HTTP/2 settings + chrome_100::http2_fingerprint(), headers(), ) } @@ -1258,8 +1272,10 @@ pub mod chrome_125 { ":status".to_string(), ], initial_stream_window_size: Some(6_291_456), - initial_connection_window_size: Some(15_663_105), + initial_connection_window_size: Some(15_728_640), max_header_list_size: Some(262_144), + header_table_size: Some(65_536), + max_concurrent_streams: None, } } diff --git a/impit/src/fingerprint/database/firefox.rs b/impit/src/fingerprint/database/firefox.rs index 5ccc8561..4bbf89fe 100644 --- a/impit/src/fingerprint/database/firefox.rs +++ b/impit/src/fingerprint/database/firefox.rs @@ -121,8 +121,10 @@ pub mod firefox_128 { ":status".to_string(), ], initial_stream_window_size: Some(131_072), - initial_connection_window_size: Some(12_517_377), + initial_connection_window_size: Some(12_582_912), max_header_list_size: None, + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -262,8 +264,10 @@ pub mod firefox_133 { ":status".to_string(), ], initial_stream_window_size: Some(131_072), - initial_connection_window_size: Some(12_517_377), + initial_connection_window_size: Some(12_582_912), max_header_list_size: None, + header_table_size: Some(65_536), + max_concurrent_streams: None, } } @@ -408,8 +412,10 @@ pub mod firefox_135 { ":status".to_string(), ], initial_stream_window_size: Some(131_072), - initial_connection_window_size: Some(12_517_377), + initial_connection_window_size: Some(12_582_912), max_header_list_size: None, + header_table_size: Some(65_536), + max_concurrent_streams: None, } } diff --git a/impit/src/fingerprint/database/okhttp.rs b/impit/src/fingerprint/database/okhttp.rs index f5dd00df..869aeff7 100644 --- a/impit/src/fingerprint/database/okhttp.rs +++ b/impit/src/fingerprint/database/okhttp.rs @@ -37,6 +37,8 @@ fn shared_http2_fingerprint() -> Http2Fingerprint { // Connection window is also increased to 16 MiB via WINDOW_UPDATE initial_connection_window_size: Some(16_777_216), max_header_list_size: None, + header_table_size: None, + max_concurrent_streams: None, } } diff --git a/impit/src/fingerprint/database/safari.rs b/impit/src/fingerprint/database/safari.rs index 23b926bd..9d900625 100644 --- a/impit/src/fingerprint/database/safari.rs +++ b/impit/src/fingerprint/database/safari.rs @@ -132,6 +132,8 @@ pub mod ios_18 { // 65_535 (h2 default) + 10_420_225 WINDOW_UPDATE = 10_485_760. initial_connection_window_size: Some(10_485_760), max_header_list_size: None, + header_table_size: None, + max_concurrent_streams: Some(100), } } diff --git a/impit/src/fingerprint/mod.rs b/impit/src/fingerprint/mod.rs index 7b249263..9d10309e 100644 --- a/impit/src/fingerprint/mod.rs +++ b/impit/src/fingerprint/mod.rs @@ -105,6 +105,8 @@ pub struct Http2Fingerprint { pub initial_stream_window_size: Option, pub initial_connection_window_size: Option, pub max_header_list_size: Option, + pub header_table_size: Option, + pub max_concurrent_streams: Option, } /// TLS extensions configuration. diff --git a/impit/src/impit.rs b/impit/src/impit.rs index 4c45610c..4609ccef 100644 --- a/impit/src/impit.rs +++ b/impit/src/impit.rs @@ -258,6 +258,14 @@ impl Impit { if let Some(max_size) = fingerprint.http2.max_header_list_size { client = client.http2_max_header_list_size(max_size); } + + if let Some(size) = fingerprint.http2.header_table_size { + client = client.http2_header_table_size(size); + } + + if let Some(max) = fingerprint.http2.max_concurrent_streams { + client = client.http2_max_concurrent_streams(max); + } } if config.max_http_version == Version::HTTP_3 {