wreq 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Cargo.lock +495 -57
- data/Cargo.toml +18 -6
- data/README.md +1 -1
- data/crates/wreq-util/CHANGELOG.md +1 -0
- data/crates/wreq-util/Cargo.toml +3 -1
- data/crates/wreq-util/README.md +4 -2
- data/crates/wreq-util/examples/emulate.rs +7 -3
- data/crates/wreq-util/examples/tower_delay.rs +4 -4
- data/crates/wreq-util/src/emulate/macros.rs +0 -1
- data/crates/wreq-util/src/emulate/profile/chrome/http2.rs +3 -3
- data/crates/wreq-util/src/emulate/profile/chrome/tls.rs +17 -39
- data/crates/wreq-util/src/emulate/profile/chrome.rs +71 -0
- data/crates/wreq-util/src/emulate/profile/firefox/http2.rs +11 -11
- data/crates/wreq-util/src/emulate/profile/firefox/tls.rs +9 -14
- data/crates/wreq-util/src/emulate/profile/okhttp.rs +9 -15
- data/crates/wreq-util/src/emulate/profile/opera/http2.rs +3 -3
- data/crates/wreq-util/src/emulate/profile/opera/tls.rs +11 -5
- data/crates/wreq-util/src/emulate/profile/safari/tls.rs +14 -15
- data/crates/wreq-util/src/emulate/profile.rs +7 -9
- data/crates/wreq-util/src/emulate.rs +3 -1
- data/crates/wreq-util/src/tower/delay/layer.rs +5 -5
- data/crates/wreq-util/src/tower/delay.rs +4 -4
- data/crates/wreq-util/tests/client.rs +7 -3
- data/crates/wreq-util/tests/emulate_chrome.rs +20 -0
- data/crates/wreq-util/tests/emulate_firefox.rs +26 -21
- data/crates/wreq-util/tests/emulate_safari.rs +1 -1
- data/crates/wreq-util/tests/support/mod.rs +16 -13
- data/lib/wreq.rb +9 -9
- data/lib/wreq_ruby/client.rb +39 -25
- data/lib/wreq_ruby/emulate.rb +7 -2
- data/lib/wreq_ruby/http.rb +9 -2
- data/src/client.rs +8 -4
- data/src/emulate.rs +2 -0
- data/test/emulation_test.rb +3 -1
- data/test/option_validation_test.rb +13 -4
- metadata +1 -1
data/Cargo.toml
CHANGED
|
@@ -5,7 +5,7 @@ authors = ["SearchApi <support@searchapi.io>"]
|
|
|
5
5
|
homepage = "https://github.com/SearchApi/wreq-ruby"
|
|
6
6
|
repository = "https://github.com/SearchApi/wreq-ruby"
|
|
7
7
|
edition = "2024"
|
|
8
|
-
version = "1.3.
|
|
8
|
+
version = "1.3.3"
|
|
9
9
|
rust-version = "1.98"
|
|
10
10
|
|
|
11
11
|
[lib]
|
|
@@ -17,7 +17,12 @@ name = "wreq_ruby"
|
|
|
17
17
|
magnus = { version = "0.8.2", features = ["bytes"] }
|
|
18
18
|
rb-sys = { version = "0.9.128", default-features = false }
|
|
19
19
|
tokio = { version = "1.53.1", features = ["full"] }
|
|
20
|
-
|
|
20
|
+
# Keep the existing trust store independent of wreq's default feature selection.
|
|
21
|
+
wreq = { version = "0.16.1", default-features = false, features = [
|
|
22
|
+
"tokio-rt",
|
|
23
|
+
"http2",
|
|
24
|
+
"http3",
|
|
25
|
+
"chromium-roots",
|
|
21
26
|
"query",
|
|
22
27
|
"form",
|
|
23
28
|
"json",
|
|
@@ -64,8 +69,15 @@ opt-level = 3
|
|
|
64
69
|
strip = true
|
|
65
70
|
|
|
66
71
|
[patch.crates-io]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
# Keep transport patches aligned with wreq's demo/brave-galileo-ac7w3r branch.
|
|
73
|
+
http2 = { git = "https://github.com/0x676e67/http2", rev = "ce505e52ce9c25fb055412cb39b1caaa7a1f70a8" }
|
|
74
|
+
http3 = { git = "https://github.com/0x676e67/http3", rev = "5bd394f3dfb8bc63591627a229c34c02caadc3af" }
|
|
75
|
+
http3-datagram = { git = "https://github.com/0x676e67/http3", rev = "5bd394f3dfb8bc63591627a229c34c02caadc3af" }
|
|
76
|
+
http3-quic = { git = "https://github.com/0x676e67/http3", rev = "5bd394f3dfb8bc63591627a229c34c02caadc3af" }
|
|
77
|
+
quic = { git = "https://github.com/0x676e67/quic", rev = "b3d74044e874c5e785f462e3032faaf021cb6958" }
|
|
78
|
+
netty = { git = "https://github.com/0x676e67/netty", rev = "0e1e53c0d9e500b253361cf6997559c44d7717b5" }
|
|
79
|
+
btls = { git = "https://github.com/0x676e67/btls", rev = "5ec1c113a03626a5877b34dd6d2ea8d440897a91" }
|
|
80
|
+
btls-sys = { git = "https://github.com/0x676e67/btls", rev = "5ec1c113a03626a5877b34dd6d2ea8d440897a91" }
|
|
81
|
+
tokio-btls = { git = "https://github.com/0x676e67/btls", rev = "5ec1c113a03626a5877b34dd6d2ea8d440897a91" }
|
|
82
|
+
wreq = { git = "https://github.com/0x676e67/wreq", rev = "10029bb86ff88d8ed88b8e10518fe6e1f7ff322c" }
|
|
71
83
|
wreq-util = { path = "crates/wreq-util" }
|
data/README.md
CHANGED
|
@@ -91,7 +91,7 @@ Most browser device models share identical TLS and HTTP/2 configurations, differ
|
|
|
91
91
|
|
|
92
92
|
| **Browser** | **Versions** |
|
|
93
93
|
| ----------- | ------------ |
|
|
94
|
-
| **Chrome** | `Chrome100`, `Chrome101`, `Chrome104`, `Chrome105`, `Chrome106`, `Chrome107`, `Chrome108`, `Chrome109`, `Chrome110`, `Chrome114`, `Chrome116`, `Chrome117`, `Chrome118`, `Chrome119`, `Chrome120`, `Chrome123`, `Chrome124`, `Chrome126`, `Chrome127`, `Chrome128`, `Chrome129`, `Chrome130`, `Chrome131`, `Chrome132`, `Chrome133`, `Chrome134`, `Chrome135`, `Chrome136`, `Chrome137`, `Chrome138`, `Chrome139`, `Chrome140`, `Chrome141`, `Chrome142`, `Chrome143`, `Chrome144`, `Chrome145`, `Chrome146`, `Chrome147`, `Chrome148`, `Chrome149`, `Chrome150`, `Chrome151`, `Chrome152`, `Chrome153`, `Chrome154`, `Chrome155` |
|
|
94
|
+
| **Chrome** | `Chrome100`, `Chrome101`, `Chrome104`, `Chrome105`, `Chrome106`, `Chrome107`, `Chrome108`, `Chrome109`, `Chrome110`, `Chrome114`, `Chrome116`, `Chrome117`, `Chrome118`, `Chrome119`, `Chrome120`, `Chrome123`, `Chrome124`, `Chrome126`, `Chrome127`, `Chrome128`, `Chrome129`, `Chrome130`, `Chrome131`, `Chrome132`, `Chrome133`, `Chrome134`, `Chrome135`, `Chrome136`, `Chrome137`, `Chrome138`, `Chrome139`, `Chrome140`, `Chrome141`, `Chrome142`, `Chrome143`, `Chrome144`, `Chrome145`, `Chrome146`, `Chrome147`, `Chrome148`, `Chrome149`, `Chrome150`, `Chrome151`, `Chrome152`, `Chrome153`, `Chrome154`, `Chrome155`, `Chrome156`, `Chrome157` |
|
|
95
95
|
| **Edge** | `Edge101`, `Edge122`, `Edge127`, `Edge131`, `Edge134`, `Edge135`, `Edge136`, `Edge137`, `Edge138`, `Edge139`, `Edge140`, `Edge141`, `Edge142`, `Edge143`, `Edge144`, `Edge145`, `Edge146`, `Edge147`, `Edge148` |
|
|
96
96
|
| **Firefox** | `Firefox109`, `Firefox117`, `Firefox128`, `Firefox133`, `Firefox135`, `FirefoxPrivate135`, `FirefoxAndroid135`, `Firefox136`, `FirefoxPrivate136`, `Firefox139`, `Firefox142`, `Firefox143`, `Firefox144`, `Firefox145`, `Firefox146`, `Firefox147`, `Firefox148`, `Firefox149`, `Firefox150`, `Firefox151`, `Firefox152` |
|
|
97
97
|
| **Safari** | `Safari15_3`, `Safari15_5`, `Safari15_6_1`, `Safari16`, `Safari16_5`, `Safari17_0`, `Safari17_2_1`, `Safari17_4_1`, `Safari17_5`, `Safari17_6`, `Safari18`, `Safari18_2`, `Safari18_3`, `Safari18_3_1`, `Safari18_5`, `Safari26`, `Safari26_1`, `Safari26_2`, `SafariIos16_5`, `SafariIos17_2`, `SafariIos17_4_1`, `SafariIos18_1_1`, `SafariIos26`, `SafariIos26_2`, `SafariIPad18`, `SafariIPad26`, `SafariIpad26_2` |
|
|
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
14
14
|
- *(emulate)* Add Chrome 153 profile.
|
|
15
15
|
- *(emulate)* Add Chrome 154 profile.
|
|
16
16
|
- *(emulate)* Add Chrome 155 profile, including the JPEG XL navigation Accept header.
|
|
17
|
+
- *(emulate)* Add Chrome 156 profile.
|
|
17
18
|
- *(emulate)* Add Firefox 152 profile.
|
|
18
19
|
|
|
19
20
|
### Fixed
|
data/crates/wreq-util/Cargo.toml
CHANGED
|
@@ -17,12 +17,13 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|
|
17
17
|
targets = ["x86_64-unknown-linux-gnu"]
|
|
18
18
|
|
|
19
19
|
[features]
|
|
20
|
-
default = ["emulation"]
|
|
20
|
+
default = ["emulation", "tokio-rt"]
|
|
21
21
|
|
|
22
22
|
tokio-rt = ["wreq/tokio-rt"]
|
|
23
23
|
compio-rt = ["wreq/compio-rt"]
|
|
24
24
|
|
|
25
25
|
emulation = [
|
|
26
|
+
"wreq/http2",
|
|
26
27
|
"dep:typed-builder",
|
|
27
28
|
"dep:brotli",
|
|
28
29
|
"dep:flate2",
|
|
@@ -54,6 +55,7 @@ zstd = { version = "0.13.3", optional = true }
|
|
|
54
55
|
|
|
55
56
|
[dev-dependencies]
|
|
56
57
|
wreq = "0.16.1"
|
|
58
|
+
serde_json = "1.0.151"
|
|
57
59
|
tokio = { version = "1.48.0", features = ["full"] }
|
|
58
60
|
hyper = { version = "1.10.1", default-features = false, features = [
|
|
59
61
|
"http1",
|
data/crates/wreq-util/README.md
CHANGED
|
@@ -20,12 +20,14 @@ See the [crate documentation](https://docs.rs/wreq-util/latest/wreq_util) for mo
|
|
|
20
20
|
|
|
21
21
|
## Example
|
|
22
22
|
|
|
23
|
+
This vendored copy uses the development wreq revision pinned in the [root Cargo.toml](../../Cargo.toml). Building it independently requires the same Git patches.
|
|
24
|
+
|
|
23
25
|
The following example uses the [Tokio](https://tokio.rs) runtime with optional features enabled by adding this to your `Cargo.toml`:
|
|
24
26
|
|
|
25
27
|
```toml
|
|
26
28
|
[dependencies]
|
|
27
29
|
tokio = { version = "1", features = ["full"] }
|
|
28
|
-
wreq = "
|
|
30
|
+
wreq = "0.16.1"
|
|
29
31
|
wreq-util = "3.0.0-rc"
|
|
30
32
|
```
|
|
31
33
|
|
|
@@ -38,7 +40,7 @@ use wreq_util::Emulation;
|
|
|
38
40
|
#[tokio::main]
|
|
39
41
|
async fn main() -> wreq::Result<()> {
|
|
40
42
|
// Build a client
|
|
41
|
-
let client = Client::
|
|
43
|
+
let client = Client::builder_tokio()
|
|
42
44
|
.emulation(Emulation::Chrome147)
|
|
43
45
|
.build()?;
|
|
44
46
|
|
|
@@ -2,8 +2,10 @@ use wreq_util::{Emulation, Platform, Profile};
|
|
|
2
2
|
|
|
3
3
|
#[tokio::main]
|
|
4
4
|
async fn main() -> Result<(), wreq::Error> {
|
|
5
|
+
let client = wreq::Client::builder_tokio().build()?;
|
|
5
6
|
// Example 1: Basic emulation - Safari26
|
|
6
|
-
let text =
|
|
7
|
+
let text = client
|
|
8
|
+
.get("https://pingly.us.kg/api/all")
|
|
7
9
|
.emulation(Emulation::Safari26)
|
|
8
10
|
.send()
|
|
9
11
|
.await?
|
|
@@ -12,7 +14,8 @@ async fn main() -> Result<(), wreq::Error> {
|
|
|
12
14
|
println!("{}\n", text);
|
|
13
15
|
|
|
14
16
|
// Example 2: Advanced emulation with options - OkHttp5
|
|
15
|
-
let text =
|
|
17
|
+
let text = client
|
|
18
|
+
.get("https://pingly.us.kg/api/all")
|
|
16
19
|
.emulation(
|
|
17
20
|
Emulation::builder()
|
|
18
21
|
.profile(Profile::OkHttp5)
|
|
@@ -27,7 +30,8 @@ async fn main() -> Result<(), wreq::Error> {
|
|
|
27
30
|
println!("{}\n", text);
|
|
28
31
|
|
|
29
32
|
// Example 3: Random device emulation
|
|
30
|
-
let text =
|
|
33
|
+
let text = client
|
|
34
|
+
.get("https://pingly.us.kg/api/all")
|
|
31
35
|
.emulation(Emulation::random())
|
|
32
36
|
.send()
|
|
33
37
|
.await?
|
|
@@ -5,7 +5,7 @@ use wreq_util::tower::delay::{DelayLayer, JitterDelayLayer};
|
|
|
5
5
|
#[tokio::main]
|
|
6
6
|
async fn main() -> Result<(), wreq::Error> {
|
|
7
7
|
// Build a client with a 1 second delay between requests
|
|
8
|
-
let client = Client::
|
|
8
|
+
let client = Client::builder_tokio()
|
|
9
9
|
.layer(DelayLayer::new(Duration::from_secs(1)))
|
|
10
10
|
.tls_cert_verification(false)
|
|
11
11
|
.build()?;
|
|
@@ -52,7 +52,7 @@ async fn basic_jitter_delay() -> Result<(), wreq::Error> {
|
|
|
52
52
|
println!("=== Basic Jittered Delay ===\n");
|
|
53
53
|
|
|
54
54
|
// Build a client with jittered delay: base 1s ± 50% (range: 0.5s to 1.5s)
|
|
55
|
-
let client = Client::
|
|
55
|
+
let client = Client::builder_tokio()
|
|
56
56
|
.layer(JitterDelayLayer::new(Duration::from_secs(1), 0.5))
|
|
57
57
|
.tls_cert_verification(false)
|
|
58
58
|
.build()?;
|
|
@@ -100,7 +100,7 @@ async fn basic_jitter_delay() -> Result<(), wreq::Error> {
|
|
|
100
100
|
async fn conditional_jitter_delay() -> Result<(), wreq::Error> {
|
|
101
101
|
println!("=== Conditional Jittered Delay (using `JitterDelayLayer::when`) ===\n");
|
|
102
102
|
|
|
103
|
-
let client = Client::
|
|
103
|
+
let client = Client::builder_tokio()
|
|
104
104
|
.layer(JitterDelayLayer::new(Duration::from_millis(800), 0.3).when(
|
|
105
105
|
|req: &http::Request<_>| {
|
|
106
106
|
// Only apply delay to POST requests
|
|
@@ -149,7 +149,7 @@ async fn conditional_fixed_delay() -> Result<(), wreq::Error> {
|
|
|
149
149
|
println!("=== Conditional Fixed Delay (using `DelayLayer::when`) ===\n");
|
|
150
150
|
|
|
151
151
|
// Build a client that only delays requests to specific paths
|
|
152
|
-
let client = Client::
|
|
152
|
+
let client = Client::builder_tokio()
|
|
153
153
|
.layer(
|
|
154
154
|
DelayLayer::new(Duration::from_secs(1)).when(|req: &http::Request<_>| {
|
|
155
155
|
// Only apply delay to /delay/* endpoints
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
macro_rules!
|
|
1
|
+
macro_rules! headers_priority {
|
|
2
2
|
() => {
|
|
3
|
-
|
|
3
|
+
HeadersPriority::new(HeadersDependency::Root, 255, true)
|
|
4
4
|
};
|
|
5
5
|
}
|
|
6
6
|
|
|
@@ -41,7 +41,7 @@ macro_rules! http2_options {
|
|
|
41
41
|
.initial_connection_window_size(15728640)
|
|
42
42
|
.max_header_list_size(262144)
|
|
43
43
|
.header_table_size(65536)
|
|
44
|
-
.
|
|
44
|
+
.headers_priority(headers_priority!())
|
|
45
45
|
.headers_pseudo_order(pseudo_order!())
|
|
46
46
|
.settings_order(settings_order!())
|
|
47
47
|
};
|
|
@@ -71,9 +71,6 @@ pub const CURVES_3: &str = join!(":", "X25519MLKEM768", "X25519", "P-256", "P-38
|
|
|
71
71
|
|
|
72
72
|
pub const CIPHER_LIST: &str = join!(
|
|
73
73
|
":",
|
|
74
|
-
"TLS_AES_128_GCM_SHA256",
|
|
75
|
-
"TLS_AES_256_GCM_SHA384",
|
|
76
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
77
74
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
78
75
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
79
76
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
@@ -88,6 +85,12 @@ pub const CIPHER_LIST: &str = join!(
|
|
|
88
85
|
"TLS_RSA_WITH_AES_256_CBC_SHA"
|
|
89
86
|
);
|
|
90
87
|
|
|
88
|
+
pub const TLS13_CIPHER_LIST: &[Tls13Cipher] = &[
|
|
89
|
+
Tls13Cipher::AES_128_GCM_SHA256,
|
|
90
|
+
Tls13Cipher::AES_256_GCM_SHA384,
|
|
91
|
+
Tls13Cipher::CHACHA20_POLY1305_SHA256,
|
|
92
|
+
];
|
|
93
|
+
|
|
91
94
|
pub const SIGALGS_LIST: &str = join!(
|
|
92
95
|
":",
|
|
93
96
|
"ecdsa_secp256r1_sha256",
|
|
@@ -200,14 +203,17 @@ impl From<ChromeTlsConfig> for TlsOptions {
|
|
|
200
203
|
.curves_list(val.curves)
|
|
201
204
|
.sigalgs_list(val.sigalgs_list)
|
|
202
205
|
.cipher_list(val.cipher_list)
|
|
206
|
+
.tls13_cipher_list(TLS13_CIPHER_LIST)
|
|
203
207
|
.min_tls_version(TlsVersion::TLS_1_2)
|
|
204
208
|
.max_tls_version(TlsVersion::TLS_1_3)
|
|
205
209
|
.permute_extensions(val.permute_extensions)
|
|
206
210
|
.pre_shared_key(val.pre_shared_key)
|
|
207
|
-
.
|
|
211
|
+
.ech_grease(
|
|
212
|
+
val.enable_ech_grease
|
|
213
|
+
.then_some(EchGrease::Aead(EchGreaseAead::AES_128_GCM)),
|
|
214
|
+
)
|
|
208
215
|
.alps_protocols([val.alps_protos])
|
|
209
216
|
.alps_use_new_codepoint(val.alps_use_new_codepoint)
|
|
210
|
-
.aes_hw_override(true)
|
|
211
217
|
.certificate_compressors(CERTIFICATE_COMPRESSORS);
|
|
212
218
|
let builder = if let Some(trust_anchors) = val.trust_anchors {
|
|
213
219
|
builder.trust_anchors(trust_anchors)
|
|
@@ -226,42 +232,14 @@ impl From<ChromeTlsConfig> for TlsOptions {
|
|
|
226
232
|
#[cfg(test)]
|
|
227
233
|
mod tests {
|
|
228
234
|
use super::*;
|
|
229
|
-
use wreq::IntoEmulation;
|
|
230
235
|
|
|
231
236
|
#[test]
|
|
232
|
-
fn
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
] {
|
|
239
|
-
let native = profile.into_emulation();
|
|
240
|
-
let cloned = native.clone();
|
|
241
|
-
let ids = native.tls_options.unwrap().trust_anchors.unwrap();
|
|
242
|
-
assert_eq!(ids.len(), CHROME_TRUST_ANCHORS.len());
|
|
243
|
-
assert_eq!(ids, cloned.tls_options.unwrap().trust_anchors.unwrap());
|
|
244
|
-
let decoded = decode_ids(&ids);
|
|
245
|
-
let mut expected = chromium_roots::trust_anchor_ids();
|
|
246
|
-
expected.sort_unstable();
|
|
247
|
-
if matches!(
|
|
248
|
-
profile,
|
|
249
|
-
crate::Profile::Chrome154 | crate::Profile::Chrome155
|
|
250
|
-
) {
|
|
251
|
-
assert_eq!(decoded, expected);
|
|
252
|
-
}
|
|
253
|
-
let mut actual = decoded;
|
|
254
|
-
actual.sort_unstable();
|
|
255
|
-
assert_eq!(actual, expected);
|
|
256
|
-
}
|
|
257
|
-
assert!(
|
|
258
|
-
crate::Profile::Chrome151
|
|
259
|
-
.into_emulation()
|
|
260
|
-
.tls_options
|
|
261
|
-
.unwrap()
|
|
262
|
-
.trust_anchors
|
|
263
|
-
.is_none()
|
|
264
|
-
);
|
|
237
|
+
fn sorted_trust_anchors_match_chromium_root_store() {
|
|
238
|
+
let encoded = sorted_trust_anchors();
|
|
239
|
+
let mut expected = chromium_roots::trust_anchor_ids();
|
|
240
|
+
expected.sort_unstable();
|
|
241
|
+
assert_eq!(decode_ids(&encoded), expected);
|
|
242
|
+
assert_eq!(encoded.len(), CHROME_TRUST_ANCHORS.len());
|
|
265
243
|
}
|
|
266
244
|
|
|
267
245
|
#[test]
|
|
@@ -1999,6 +1999,77 @@ mod_generator!(
|
|
|
1999
1999
|
]
|
|
2000
2000
|
);
|
|
2001
2001
|
|
|
2002
|
+
// Chrome 156 retains Chrome 155's TLS/HTTP2 and Accept configuration.
|
|
2003
|
+
// https://chromium.googlesource.com/chromium/src/+/29eb03535d5f2f4f899b95f22a92413ffde5284e/components/embedder_support/user_agent_utils.cc
|
|
2004
|
+
mod_generator!(
|
|
2005
|
+
v156,
|
|
2006
|
+
v154::build_emulation,
|
|
2007
|
+
header_initializer_chrome155,
|
|
2008
|
+
[
|
|
2009
|
+
(
|
|
2010
|
+
MacOS,
|
|
2011
|
+
r#""Not:A-Brand";v="8", "Chromium";v="156", "Google Chrome";v="156""#,
|
|
2012
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36"
|
|
2013
|
+
),
|
|
2014
|
+
(
|
|
2015
|
+
Linux,
|
|
2016
|
+
r#""Not:A-Brand";v="8", "Chromium";v="156", "Google Chrome";v="156""#,
|
|
2017
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36"
|
|
2018
|
+
),
|
|
2019
|
+
(
|
|
2020
|
+
Android,
|
|
2021
|
+
r#""Not:A-Brand";v="8", "Chromium";v="156", "Google Chrome";v="156""#,
|
|
2022
|
+
"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Mobile Safari/537.36"
|
|
2023
|
+
),
|
|
2024
|
+
(
|
|
2025
|
+
Windows,
|
|
2026
|
+
r#""Not:A-Brand";v="8", "Chromium";v="156", "Google Chrome";v="156""#,
|
|
2027
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36"
|
|
2028
|
+
),
|
|
2029
|
+
(
|
|
2030
|
+
IOS,
|
|
2031
|
+
r#""Not:A-Brand";v="8", "Chromium";v="156", "Google Chrome";v="156""#,
|
|
2032
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/156.0.8078.54 Mobile/15E148 Safari/604.1"
|
|
2033
|
+
)
|
|
2034
|
+
]
|
|
2035
|
+
);
|
|
2036
|
+
|
|
2037
|
+
// Chrome 157 retains Chrome 156's TLS/HTTP2 and Accept configuration.
|
|
2038
|
+
// Its UA-CH order and GREASE brand are seeded by major version 157.
|
|
2039
|
+
// https://chromium.googlesource.com/chromium/src/+/653674df293788cf4932c40d914e9e15b41a2d31/components/embedder_support/user_agent_utils.cc
|
|
2040
|
+
mod_generator!(
|
|
2041
|
+
v157,
|
|
2042
|
+
v154::build_emulation,
|
|
2043
|
+
header_initializer_chrome155,
|
|
2044
|
+
[
|
|
2045
|
+
(
|
|
2046
|
+
MacOS,
|
|
2047
|
+
r#""Not-A.Brand";v="99", "Google Chrome";v="157", "Chromium";v="157""#,
|
|
2048
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36"
|
|
2049
|
+
),
|
|
2050
|
+
(
|
|
2051
|
+
Linux,
|
|
2052
|
+
r#""Not-A.Brand";v="99", "Google Chrome";v="157", "Chromium";v="157""#,
|
|
2053
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36"
|
|
2054
|
+
),
|
|
2055
|
+
(
|
|
2056
|
+
Android,
|
|
2057
|
+
r#""Not-A.Brand";v="99", "Google Chrome";v="157", "Chromium";v="157""#,
|
|
2058
|
+
"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Mobile Safari/537.36"
|
|
2059
|
+
),
|
|
2060
|
+
(
|
|
2061
|
+
Windows,
|
|
2062
|
+
r#""Not-A.Brand";v="99", "Google Chrome";v="157", "Chromium";v="157""#,
|
|
2063
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36"
|
|
2064
|
+
),
|
|
2065
|
+
(
|
|
2066
|
+
IOS,
|
|
2067
|
+
r#""Not-A.Brand";v="99", "Google Chrome";v="157", "Chromium";v="157""#,
|
|
2068
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/157.0.8103.37 Mobile/15E148 Safari/604.1"
|
|
2069
|
+
)
|
|
2070
|
+
]
|
|
2071
|
+
);
|
|
2072
|
+
|
|
2002
2073
|
mod_generator!(
|
|
2003
2074
|
edge143,
|
|
2004
2075
|
v132::build_emulation,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
macro_rules!
|
|
1
|
+
macro_rules! headers_priority {
|
|
2
2
|
(1) => {
|
|
3
|
-
|
|
3
|
+
HeadersPriority::new(HeadersDependency::Root, 41, false)
|
|
4
4
|
};
|
|
5
5
|
(2) => {
|
|
6
|
-
|
|
6
|
+
HeadersPriority::new(HeadersDependency::Declared(StreamId::from(13)), 41, false)
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -52,28 +52,28 @@ macro_rules! http2_options {
|
|
|
52
52
|
.initial_stream_id(3)
|
|
53
53
|
.header_table_size(65536)
|
|
54
54
|
.enable_push(false)
|
|
55
|
-
.
|
|
55
|
+
.headers_priority(headers_priority!(1))
|
|
56
56
|
.build()
|
|
57
57
|
};
|
|
58
58
|
(2) => {
|
|
59
59
|
http2_options!(@base Http2Options::builder())
|
|
60
60
|
.initial_stream_id(15)
|
|
61
61
|
.header_table_size(65536)
|
|
62
|
-
.
|
|
62
|
+
.headers_priority(headers_priority!(2))
|
|
63
63
|
.priorities(
|
|
64
64
|
Priorities::builder()
|
|
65
65
|
.extend([
|
|
66
66
|
Priority::new(
|
|
67
67
|
StreamId::from(3),
|
|
68
|
-
StreamDependency::new(StreamId::
|
|
68
|
+
StreamDependency::new(StreamId::from(0), 200, false),
|
|
69
69
|
),
|
|
70
70
|
Priority::new(
|
|
71
71
|
StreamId::from(5),
|
|
72
|
-
StreamDependency::new(StreamId::
|
|
72
|
+
StreamDependency::new(StreamId::from(0), 100, false),
|
|
73
73
|
),
|
|
74
74
|
Priority::new(
|
|
75
75
|
StreamId::from(7),
|
|
76
|
-
StreamDependency::new(StreamId::
|
|
76
|
+
StreamDependency::new(StreamId::from(0), 0, false),
|
|
77
77
|
),
|
|
78
78
|
Priority::new(
|
|
79
79
|
StreamId::from(9),
|
|
@@ -85,7 +85,7 @@ macro_rules! http2_options {
|
|
|
85
85
|
),
|
|
86
86
|
Priority::new(
|
|
87
87
|
StreamId::from(13),
|
|
88
|
-
StreamDependency::new(StreamId::
|
|
88
|
+
StreamDependency::new(StreamId::from(0), 240, false),
|
|
89
89
|
),
|
|
90
90
|
])
|
|
91
91
|
.build(),
|
|
@@ -98,7 +98,7 @@ macro_rules! http2_options {
|
|
|
98
98
|
.header_table_size(65536)
|
|
99
99
|
.enable_push(false)
|
|
100
100
|
.max_concurrent_streams(0)
|
|
101
|
-
.
|
|
101
|
+
.headers_priority(headers_priority!(1))
|
|
102
102
|
.build()
|
|
103
103
|
};
|
|
104
104
|
(4) => {
|
|
@@ -107,7 +107,7 @@ macro_rules! http2_options {
|
|
|
107
107
|
.header_table_size(4096)
|
|
108
108
|
.enable_push(false)
|
|
109
109
|
.initial_window_size(32768)
|
|
110
|
-
.
|
|
110
|
+
.headers_priority(headers_priority!(1))
|
|
111
111
|
.build()
|
|
112
112
|
};
|
|
113
113
|
}
|
|
@@ -86,9 +86,6 @@ pub const KEY_SHARES_2: &[KeyShare] =
|
|
|
86
86
|
|
|
87
87
|
pub const CIPHER_LIST_1: &str = join!(
|
|
88
88
|
":",
|
|
89
|
-
"TLS_AES_128_GCM_SHA256",
|
|
90
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
91
|
-
"TLS_AES_256_GCM_SHA384",
|
|
92
89
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
93
90
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
94
91
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
|
@@ -107,9 +104,6 @@ pub const CIPHER_LIST_1: &str = join!(
|
|
|
107
104
|
|
|
108
105
|
pub const CIPHER_LIST_2: &str = join!(
|
|
109
106
|
":",
|
|
110
|
-
"TLS_AES_128_GCM_SHA256",
|
|
111
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
112
|
-
"TLS_AES_256_GCM_SHA384",
|
|
113
107
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
114
108
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
115
109
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
|
@@ -126,9 +120,6 @@ pub const CIPHER_LIST_2: &str = join!(
|
|
|
126
120
|
|
|
127
121
|
pub const CIPHER_LIST_3: &str = join!(
|
|
128
122
|
":",
|
|
129
|
-
"TLS_AES_128_GCM_SHA256",
|
|
130
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
131
|
-
"TLS_AES_256_GCM_SHA384",
|
|
132
123
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
133
124
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
134
125
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
|
@@ -159,6 +150,12 @@ pub const SIGALGS_LIST: &str = join!(
|
|
|
159
150
|
"rsa_pkcs1_sha1"
|
|
160
151
|
);
|
|
161
152
|
|
|
153
|
+
pub const TLS13_CIPHER_LIST: &[Tls13Cipher] = &[
|
|
154
|
+
Tls13Cipher::AES_128_GCM_SHA256,
|
|
155
|
+
Tls13Cipher::CHACHA20_POLY1305_SHA256,
|
|
156
|
+
Tls13Cipher::AES_256_GCM_SHA384,
|
|
157
|
+
];
|
|
158
|
+
|
|
162
159
|
pub const CERTIFICATE_COMPRESSORS: &[&'static dyn CertificateCompressor] =
|
|
163
160
|
&[&ZlibCompressor, &BrotliCompressor, &ZstdCompressor];
|
|
164
161
|
|
|
@@ -243,11 +240,12 @@ impl From<FirefoxTlsConfig> for TlsOptions {
|
|
|
243
240
|
.curves_list(val.curves_list)
|
|
244
241
|
.sigalgs_list(val.sigalgs_list)
|
|
245
242
|
.cipher_list(val.cipher_list)
|
|
243
|
+
.tls13_cipher_list(TLS13_CIPHER_LIST)
|
|
246
244
|
.session_ticket(val.session_ticket)
|
|
247
245
|
.delegated_credentials(val.delegated_credentials)
|
|
248
246
|
.record_size_limit(val.record_size_limit)
|
|
249
247
|
.enable_ocsp_stapling(true)
|
|
250
|
-
.
|
|
248
|
+
.ech_grease(val.enable_ech_grease.then_some(EchGrease::NssPre3127))
|
|
251
249
|
.enable_signed_cert_timestamps(val.enable_signed_cert_timestamps)
|
|
252
250
|
.alpn_protocols([AlpnProtocol::HTTP2, AlpnProtocol::HTTP1])
|
|
253
251
|
.min_tls_version(TlsVersion::TLS_1_2)
|
|
@@ -255,10 +253,7 @@ impl From<FirefoxTlsConfig> for TlsOptions {
|
|
|
255
253
|
.pre_shared_key(val.pre_shared_key)
|
|
256
254
|
.psk_skip_session_ticket(val.psk_skip_session_tickets)
|
|
257
255
|
.psk_dhe_ke(val.psk_dhe_ke)
|
|
258
|
-
.
|
|
259
|
-
.extension_permutation(val.extension_permutation)
|
|
260
|
-
.aes_hw_override(true)
|
|
261
|
-
.random_aes_hw_override(true);
|
|
256
|
+
.extension_permutation(val.extension_permutation);
|
|
262
257
|
|
|
263
258
|
if let Some(key_shares) = val.key_shares {
|
|
264
259
|
builder = builder.key_shares(key_shares)
|
|
@@ -17,9 +17,6 @@ const SIGALGS_LIST: &str = join!(
|
|
|
17
17
|
|
|
18
18
|
const CIPHER_LIST: &str = join!(
|
|
19
19
|
":",
|
|
20
|
-
"TLS_AES_128_GCM_SHA256",
|
|
21
|
-
"TLS_AES_256_GCM_SHA384",
|
|
22
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
23
20
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
24
21
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
25
22
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
@@ -35,6 +32,12 @@ const CIPHER_LIST: &str = join!(
|
|
|
35
32
|
"TLS_RSA_WITH_3DES_EDE_CBC_SHA"
|
|
36
33
|
);
|
|
37
34
|
|
|
35
|
+
const TLS13_CIPHER_LIST: &[Tls13Cipher] = &[
|
|
36
|
+
Tls13Cipher::AES_128_GCM_SHA256,
|
|
37
|
+
Tls13Cipher::AES_256_GCM_SHA384,
|
|
38
|
+
Tls13Cipher::CHACHA20_POLY1305_SHA256,
|
|
39
|
+
];
|
|
40
|
+
|
|
38
41
|
#[derive(TypedBuilder)]
|
|
39
42
|
struct OkHttpTlsConfig {
|
|
40
43
|
#[builder(default = CURVES)]
|
|
@@ -53,9 +56,9 @@ impl From<OkHttpTlsConfig> for TlsOptions {
|
|
|
53
56
|
.curves_list(val.curves)
|
|
54
57
|
.sigalgs_list(val.sigalgs_list)
|
|
55
58
|
.cipher_list(val.cipher_list)
|
|
59
|
+
.tls13_cipher_list(TLS13_CIPHER_LIST)
|
|
56
60
|
.min_tls_version(TlsVersion::TLS_1_2)
|
|
57
61
|
.max_tls_version(TlsVersion::TLS_1_3)
|
|
58
|
-
.aes_hw_override(true)
|
|
59
62
|
.build()
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -66,14 +69,13 @@ macro_rules! mod_generator {
|
|
|
66
69
|
use super::*;
|
|
67
70
|
|
|
68
71
|
pub fn emulation(emulation: Emulation) -> wreq::Emulation {
|
|
69
|
-
build_emulation(
|
|
72
|
+
build_emulation(emulation, $cipher, $ua)
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
fn build_emulation(
|
|
76
|
-
group: &'static str,
|
|
77
79
|
emulation: Emulation,
|
|
78
80
|
cipher_list: &'static str,
|
|
79
81
|
user_agent: &'static str,
|
|
@@ -124,7 +126,7 @@ fn build_emulation(
|
|
|
124
126
|
headers
|
|
125
127
|
});
|
|
126
128
|
|
|
127
|
-
build_standard_emulation(
|
|
129
|
+
build_standard_emulation(tls_options, http2_options, headers)
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
mod_generator!(
|
|
@@ -175,11 +177,6 @@ mod_generator!(
|
|
|
175
177
|
okhttp3_13,
|
|
176
178
|
join!(
|
|
177
179
|
":",
|
|
178
|
-
"TLS_AES_128_GCM_SHA256",
|
|
179
|
-
"TLS_AES_256_GCM_SHA384",
|
|
180
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
181
|
-
"TLS_AES_128_CCM_SHA256",
|
|
182
|
-
"TLS_AES_256_CCM_8_SHA256",
|
|
183
180
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
184
181
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
185
182
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
@@ -213,9 +210,6 @@ mod_generator!(
|
|
|
213
210
|
okhttp4_9,
|
|
214
211
|
join!(
|
|
215
212
|
":",
|
|
216
|
-
"TLS_AES_128_GCM_SHA256",
|
|
217
|
-
"TLS_AES_256_GCM_SHA384",
|
|
218
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
219
213
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
220
214
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
221
215
|
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
macro_rules!
|
|
1
|
+
macro_rules! headers_priority {
|
|
2
2
|
() => {
|
|
3
|
-
|
|
3
|
+
HeadersPriority::new(HeadersDependency::Root, 255, true)
|
|
4
4
|
};
|
|
5
5
|
}
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ macro_rules! http2_options {
|
|
|
42
42
|
.max_header_list_size(262144)
|
|
43
43
|
.header_table_size(65536)
|
|
44
44
|
.enable_push(false)
|
|
45
|
-
.
|
|
45
|
+
.headers_priority(headers_priority!())
|
|
46
46
|
.headers_pseudo_order(pseudo_order!())
|
|
47
47
|
.settings_order(settings_order!())
|
|
48
48
|
.build()
|
|
@@ -16,9 +16,6 @@ pub const CURVES: &str = join!(":", "X25519MLKEM768", "X25519", "P-256", "P-384"
|
|
|
16
16
|
|
|
17
17
|
pub const CIPHER_LIST: &str = join!(
|
|
18
18
|
":",
|
|
19
|
-
"TLS_AES_128_GCM_SHA256",
|
|
20
|
-
"TLS_AES_256_GCM_SHA384",
|
|
21
|
-
"TLS_CHACHA20_POLY1305_SHA256",
|
|
22
19
|
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
23
20
|
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
24
21
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
@@ -33,6 +30,12 @@ pub const CIPHER_LIST: &str = join!(
|
|
|
33
30
|
"TLS_RSA_WITH_AES_256_CBC_SHA"
|
|
34
31
|
);
|
|
35
32
|
|
|
33
|
+
pub const TLS13_CIPHER_LIST: &[Tls13Cipher] = &[
|
|
34
|
+
Tls13Cipher::AES_128_GCM_SHA256,
|
|
35
|
+
Tls13Cipher::AES_256_GCM_SHA384,
|
|
36
|
+
Tls13Cipher::CHACHA20_POLY1305_SHA256,
|
|
37
|
+
];
|
|
38
|
+
|
|
36
39
|
pub const SIGALGS_LIST: &str = join!(
|
|
37
40
|
":",
|
|
38
41
|
"ecdsa_secp256r1_sha256",
|
|
@@ -83,14 +86,17 @@ impl From<OperaTlsConfig> for TlsOptions {
|
|
|
83
86
|
.curves_list(val.curves)
|
|
84
87
|
.sigalgs_list(val.sigalgs_list)
|
|
85
88
|
.cipher_list(val.cipher_list)
|
|
89
|
+
.tls13_cipher_list(TLS13_CIPHER_LIST)
|
|
86
90
|
.min_tls_version(TlsVersion::TLS_1_2)
|
|
87
91
|
.max_tls_version(TlsVersion::TLS_1_3)
|
|
88
92
|
.permute_extensions(val.permute_extensions)
|
|
89
93
|
.pre_shared_key(val.pre_shared_key)
|
|
90
|
-
.
|
|
94
|
+
.ech_grease(
|
|
95
|
+
val.enable_ech_grease
|
|
96
|
+
.then_some(EchGrease::Aead(EchGreaseAead::AES_128_GCM)),
|
|
97
|
+
)
|
|
91
98
|
.alps_protocols([val.alps_protos])
|
|
92
99
|
.alps_use_new_codepoint(val.alps_use_new_codepoint)
|
|
93
|
-
.aes_hw_override(true)
|
|
94
100
|
.certificate_compressors(CERTIFICATE_COMPRESSORS)
|
|
95
101
|
.build()
|
|
96
102
|
}
|