wreq 1.2.14 → 1.2.16
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 +1 -1
- data/Cargo.toml +1 -1
- data/README.md +2 -2
- data/crates/wreq-util/CHANGELOG.md +6 -0
- data/crates/wreq-util/src/emulate/macros.rs +12 -17
- data/crates/wreq-util/src/emulate/profile/chrome.rs +33 -0
- data/crates/wreq-util/src/emulate/profile/firefox/header.rs +22 -0
- data/crates/wreq-util/src/emulate/profile/firefox/tls.rs +20 -0
- data/crates/wreq-util/src/emulate/profile/firefox.rs +36 -7
- data/crates/wreq-util/src/emulate.rs +2 -0
- data/crates/wreq-util/tests/emulate_chrome.rs +10 -0
- data/crates/wreq-util/tests/emulate_firefox.rs +79 -0
- data/lib/wreq_ruby/emulate.rb +2 -0
- data/src/emulate.rs +2 -0
- data/test/emulation_test.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e05412727cca397064368fd0c6f79c77efced70c13467850aad2cc4941aeeb9f
|
|
4
|
+
data.tar.gz: d5c40280a601d1ead2e79f647ce737bb6f442ed750d04eca609803c1d403dce6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fef4a8ba4a3be468852f69a2d54f8ae2a4b33acdba75258836593ce263ff92993070ad1f5c43db07b5f45f5c0b72d7ca801667c2612238f0797d87faa95271b0
|
|
7
|
+
data.tar.gz: a7681af7b04813bb2826eb04b47b4ebb9af9343897f85b241cc7b61756c180ac2712530180044b1d1558a827b8da1032d9e3a8a64e0a7193f24fc31f96470d41
|
data/Cargo.lock
CHANGED
data/Cargo.toml
CHANGED
data/README.md
CHANGED
|
@@ -91,9 +91,9 @@ 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` |
|
|
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` |
|
|
95
95
|
| **Edge** | `Edge101`, `Edge122`, `Edge127`, `Edge131`, `Edge134`, `Edge135`, `Edge136`, `Edge137`, `Edge138`, `Edge139`, `Edge140`, `Edge141`, `Edge142`, `Edge143`, `Edge144`, `Edge145`, `Edge146`, `Edge147`, `Edge148` |
|
|
96
|
-
| **Firefox** | `Firefox109`, `Firefox117`, `Firefox128`, `Firefox133`, `Firefox135`, `FirefoxPrivate135`, `FirefoxAndroid135`, `Firefox136`, `FirefoxPrivate136`, `Firefox139`, `Firefox142`, `Firefox143`, `Firefox144`, `Firefox145`, `Firefox146`, `Firefox147`, `Firefox148`, `Firefox149`, `Firefox150`, `Firefox151` |
|
|
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` |
|
|
98
98
|
| **OkHttp** | `Opera116`, `Opera117`, `Opera118`, `Opera119`, `Opera120`, `Opera121`, `Opera122`, `Opera123`, `Opera124`, `Opera125`, `Opera126`, `Opera127`, `Opera128`, `Opera129`, `Opera130` |
|
|
99
99
|
| **Opera** | `Opera116`, `Opera117`, `Opera118`, `Opera119` |
|
|
@@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
- *(emulate)* Add Chrome 151 profile.
|
|
13
13
|
- *(emulate)* Add Chrome 152 profile.
|
|
14
14
|
- *(emulate)* Add Chrome 153 profile.
|
|
15
|
+
- *(emulate)* Add Chrome 154 profile.
|
|
16
|
+
- *(emulate)* Add Firefox 152 profile.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- *(emulate)* Fix Firefox 150 and 151 cipher suite lists.
|
|
15
21
|
|
|
16
22
|
## [3.0.0-rc.14](https://github.com/0x676e67/wreq-util/compare/v3.0.0-rc.13...v3.0.0-rc.14) - 2026-07-04
|
|
17
23
|
|
|
@@ -151,32 +151,27 @@ macro_rules! header_firefox_sec_fetch {
|
|
|
151
151
|
|
|
152
152
|
macro_rules! header_firefox_accept {
|
|
153
153
|
($headers:expr) => {
|
|
154
|
-
$headers.
|
|
155
|
-
ACCEPT,
|
|
156
|
-
HeaderValue::from_static(
|
|
157
|
-
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
158
|
-
),
|
|
159
|
-
);
|
|
160
|
-
$headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static("en-US,en;q=0.5"));
|
|
161
|
-
#[cfg(feature = "emulation-compression")]
|
|
162
|
-
$headers.insert(
|
|
163
|
-
ACCEPT_ENCODING,
|
|
164
|
-
HeaderValue::from_static("gzip, deflate, br"),
|
|
165
|
-
);
|
|
154
|
+
header_firefox_accept!(@build $headers, "en-US,en;q=0.5", "gzip, deflate, br");
|
|
166
155
|
};
|
|
167
156
|
(zstd, $headers:expr) => {
|
|
157
|
+
header_firefox_accept!(@build $headers, "en-US,en;q=0.5", "gzip, deflate, br, zstd");
|
|
158
|
+
};
|
|
159
|
+
// Firefox 147 changed the generated q-value from dividing 1.0 across the list to
|
|
160
|
+
// decrementing by 0.1 per entry, so a two-entry list became q=0.9 (Bugzilla 2000765,
|
|
161
|
+
// landed in 0e050ae5116d).
|
|
162
|
+
(zstd_q09, $headers:expr) => {
|
|
163
|
+
header_firefox_accept!(@build $headers, "en-US,en;q=0.9", "gzip, deflate, br, zstd");
|
|
164
|
+
};
|
|
165
|
+
(@build $headers:expr, $accept_language:expr, $accept_encoding:expr) => {
|
|
168
166
|
$headers.insert(
|
|
169
167
|
ACCEPT,
|
|
170
168
|
HeaderValue::from_static(
|
|
171
169
|
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
172
170
|
),
|
|
173
171
|
);
|
|
174
|
-
$headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static(
|
|
172
|
+
$headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static($accept_language));
|
|
175
173
|
#[cfg(feature = "emulation-compression")]
|
|
176
|
-
$headers.insert(
|
|
177
|
-
ACCEPT_ENCODING,
|
|
178
|
-
HeaderValue::from_static("gzip, deflate, br, zstd"),
|
|
179
|
-
);
|
|
174
|
+
$headers.insert(ACCEPT_ENCODING, HeaderValue::from_static($accept_encoding));
|
|
180
175
|
};
|
|
181
176
|
}
|
|
182
177
|
|
|
@@ -1929,6 +1929,39 @@ mod_generator!(
|
|
|
1929
1929
|
]
|
|
1930
1930
|
);
|
|
1931
1931
|
|
|
1932
|
+
mod_generator!(
|
|
1933
|
+
v154,
|
|
1934
|
+
v152::build_emulation,
|
|
1935
|
+
header_initializer_with_zstd_priority,
|
|
1936
|
+
[
|
|
1937
|
+
(
|
|
1938
|
+
MacOS,
|
|
1939
|
+
r#""Chromium";v="154", "Google Chrome";v="154", "Not A(Brand";v="99""#,
|
|
1940
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36"
|
|
1941
|
+
),
|
|
1942
|
+
(
|
|
1943
|
+
Linux,
|
|
1944
|
+
r#""Chromium";v="154", "Google Chrome";v="154", "Not A(Brand";v="99""#,
|
|
1945
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36"
|
|
1946
|
+
),
|
|
1947
|
+
(
|
|
1948
|
+
Android,
|
|
1949
|
+
r#""Chromium";v="154", "Google Chrome";v="154", "Not A(Brand";v="99""#,
|
|
1950
|
+
"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Mobile Safari/537.36"
|
|
1951
|
+
),
|
|
1952
|
+
(
|
|
1953
|
+
Windows,
|
|
1954
|
+
r#""Chromium";v="154", "Google Chrome";v="154", "Not A(Brand";v="99""#,
|
|
1955
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36"
|
|
1956
|
+
),
|
|
1957
|
+
(
|
|
1958
|
+
IOS,
|
|
1959
|
+
r#""Chromium";v="154", "Google Chrome";v="154", "Not A(Brand";v="99""#,
|
|
1960
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/154.0.8037.41 Mobile/15E148 Safari/604.1"
|
|
1961
|
+
)
|
|
1962
|
+
]
|
|
1963
|
+
);
|
|
1964
|
+
|
|
1932
1965
|
mod_generator!(
|
|
1933
1966
|
edge143,
|
|
1934
1967
|
v132::build_emulation,
|
|
@@ -35,3 +35,25 @@ pub fn header_initializer_with_zstd(ua: &'static str) -> HeaderMap {
|
|
|
35
35
|
);
|
|
36
36
|
headers
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
/// Firefox 147 and later. Identical to [`header_initializer_with_zstd`] apart from the
|
|
40
|
+
/// `Accept-Language` q-value, which Firefox changed in 147 (Bugzilla 2000765).
|
|
41
|
+
pub fn header_initializer_with_zstd_q09(ua: &'static str) -> HeaderMap {
|
|
42
|
+
let mut headers = HeaderMap::new();
|
|
43
|
+
header_firefox_ua!(headers, ua);
|
|
44
|
+
header_firefox_accept!(zstd_q09, headers);
|
|
45
|
+
headers.insert(
|
|
46
|
+
HeaderName::from_static("upgrade-insecure-requests"),
|
|
47
|
+
HeaderValue::from_static("1"),
|
|
48
|
+
);
|
|
49
|
+
header_firefox_sec_fetch!(headers);
|
|
50
|
+
headers.insert(
|
|
51
|
+
HeaderName::from_static("priority"),
|
|
52
|
+
HeaderValue::from_static("u=0, i"),
|
|
53
|
+
);
|
|
54
|
+
headers.insert(
|
|
55
|
+
HeaderName::from_static("te"),
|
|
56
|
+
HeaderValue::from_static("trailers"),
|
|
57
|
+
);
|
|
58
|
+
headers
|
|
59
|
+
}
|
|
@@ -124,6 +124,26 @@ pub const CIPHER_LIST_2: &str = join!(
|
|
|
124
124
|
"TLS_RSA_WITH_AES_256_CBC_SHA"
|
|
125
125
|
);
|
|
126
126
|
|
|
127
|
+
pub const CIPHER_LIST_3: &str = join!(
|
|
128
|
+
":",
|
|
129
|
+
"TLS_AES_128_GCM_SHA256",
|
|
130
|
+
"TLS_CHACHA20_POLY1305_SHA256",
|
|
131
|
+
"TLS_AES_256_GCM_SHA384",
|
|
132
|
+
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
|
133
|
+
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
|
|
134
|
+
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
|
135
|
+
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
|
|
136
|
+
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
137
|
+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
|
|
138
|
+
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
|
|
139
|
+
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
|
|
140
|
+
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
|
|
141
|
+
"TLS_RSA_WITH_AES_128_GCM_SHA256",
|
|
142
|
+
"TLS_RSA_WITH_AES_256_GCM_SHA384",
|
|
143
|
+
"TLS_RSA_WITH_AES_128_CBC_SHA",
|
|
144
|
+
"TLS_RSA_WITH_AES_256_CBC_SHA"
|
|
145
|
+
);
|
|
146
|
+
|
|
127
147
|
pub const SIGALGS_LIST: &str = join!(
|
|
128
148
|
":",
|
|
129
149
|
"ecdsa_secp256r1_sha256",
|
|
@@ -380,7 +380,7 @@ mod_generator!(
|
|
|
380
380
|
mod_generator!(
|
|
381
381
|
ff147,
|
|
382
382
|
ff135::build_emulation,
|
|
383
|
-
|
|
383
|
+
header_initializer_with_zstd_q09,
|
|
384
384
|
[
|
|
385
385
|
(
|
|
386
386
|
Windows,
|
|
@@ -408,7 +408,7 @@ mod_generator!(
|
|
|
408
408
|
mod_generator!(
|
|
409
409
|
ff148,
|
|
410
410
|
ff135::build_emulation,
|
|
411
|
-
|
|
411
|
+
header_initializer_with_zstd_q09,
|
|
412
412
|
[
|
|
413
413
|
(
|
|
414
414
|
Windows,
|
|
@@ -436,7 +436,7 @@ mod_generator!(
|
|
|
436
436
|
mod_generator!(
|
|
437
437
|
ff149,
|
|
438
438
|
ff135::build_emulation,
|
|
439
|
-
|
|
439
|
+
header_initializer_with_zstd_q09,
|
|
440
440
|
[
|
|
441
441
|
(
|
|
442
442
|
Windows,
|
|
@@ -463,8 +463,9 @@ mod_generator!(
|
|
|
463
463
|
|
|
464
464
|
mod_generator!(
|
|
465
465
|
ff150,
|
|
466
|
-
|
|
467
|
-
|
|
466
|
+
tls_options!(4, CIPHER_LIST_3, CURVES_2, KEY_SHARES_2),
|
|
467
|
+
http2_options!(1),
|
|
468
|
+
header_initializer_with_zstd_q09,
|
|
468
469
|
[
|
|
469
470
|
(
|
|
470
471
|
Windows,
|
|
@@ -491,8 +492,8 @@ mod_generator!(
|
|
|
491
492
|
|
|
492
493
|
mod_generator!(
|
|
493
494
|
ff151,
|
|
494
|
-
|
|
495
|
-
|
|
495
|
+
ff150::build_emulation,
|
|
496
|
+
header_initializer_with_zstd_q09,
|
|
496
497
|
[
|
|
497
498
|
(
|
|
498
499
|
Windows,
|
|
@@ -516,3 +517,31 @@ mod_generator!(
|
|
|
516
517
|
)
|
|
517
518
|
]
|
|
518
519
|
);
|
|
520
|
+
|
|
521
|
+
mod_generator!(
|
|
522
|
+
ff152,
|
|
523
|
+
ff150::build_emulation,
|
|
524
|
+
header_initializer_with_zstd_q09,
|
|
525
|
+
[
|
|
526
|
+
(
|
|
527
|
+
Windows,
|
|
528
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0"
|
|
529
|
+
),
|
|
530
|
+
(
|
|
531
|
+
MacOS,
|
|
532
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:152.0) Gecko/20100101 Firefox/152.0"
|
|
533
|
+
),
|
|
534
|
+
(
|
|
535
|
+
Linux,
|
|
536
|
+
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0"
|
|
537
|
+
),
|
|
538
|
+
(
|
|
539
|
+
Android,
|
|
540
|
+
"Mozilla/5.0 (Android 13; Mobile; rv:152.0) Gecko/152.0 Firefox/152.0"
|
|
541
|
+
),
|
|
542
|
+
(
|
|
543
|
+
IOS,
|
|
544
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/152.0 Mobile/15E148 Safari/605.1.15"
|
|
545
|
+
)
|
|
546
|
+
]
|
|
547
|
+
);
|
|
@@ -64,6 +64,7 @@ define_enum!(
|
|
|
64
64
|
Chrome151 => ("chrome_151", v151::emulation),
|
|
65
65
|
Chrome152 => ("chrome_152", v152::emulation),
|
|
66
66
|
Chrome153 => ("chrome_153", v153::emulation),
|
|
67
|
+
Chrome154 => ("chrome_154", v154::emulation),
|
|
67
68
|
|
|
68
69
|
// Edge versions
|
|
69
70
|
Edge101 => ("edge_101", edge101::emulation),
|
|
@@ -125,6 +126,7 @@ define_enum!(
|
|
|
125
126
|
Firefox149 => ("firefox_149", ff149::emulation),
|
|
126
127
|
Firefox150 => ("firefox_150", ff150::emulation),
|
|
127
128
|
Firefox151 => ("firefox_151", ff151::emulation),
|
|
129
|
+
Firefox152 => ("firefox_152", ff152::emulation),
|
|
128
130
|
|
|
129
131
|
// Safari versions
|
|
130
132
|
SafariIos17_2 => ("safari_ios_17.2", safari_ios_17_2::emulation),
|
|
@@ -295,3 +295,13 @@ test_emulation!(
|
|
|
295
295
|
],
|
|
296
296
|
"52d84b11737d980aef856699f885ca86"
|
|
297
297
|
);
|
|
298
|
+
|
|
299
|
+
test_emulation!(
|
|
300
|
+
test_chrome154,
|
|
301
|
+
Emulation::Chrome154,
|
|
302
|
+
[
|
|
303
|
+
"t13d1517h2_8daaf6152771_cb7bf5808d99",
|
|
304
|
+
"t13d1518h2_8daaf6152771_e2d80978ab2e"
|
|
305
|
+
],
|
|
306
|
+
"52d84b11737d980aef856699f885ca86"
|
|
307
|
+
);
|
|
@@ -90,3 +90,82 @@ test_emulation!(
|
|
|
90
90
|
["t13d1717h2_5b57614c22b0_3cbfd9057e0d"],
|
|
91
91
|
"6ea73faa8fc5aac76bded7bd238f6433"
|
|
92
92
|
);
|
|
93
|
+
|
|
94
|
+
test_emulation!(
|
|
95
|
+
test_firefox_150,
|
|
96
|
+
Emulation::Firefox150,
|
|
97
|
+
["t13d1617h2_86a278354501_3cbfd9057e0d"],
|
|
98
|
+
"6ea73faa8fc5aac76bded7bd238f6433"
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
test_emulation!(
|
|
102
|
+
test_firefox_151,
|
|
103
|
+
Emulation::Firefox151,
|
|
104
|
+
["t13d1617h2_86a278354501_3cbfd9057e0d"],
|
|
105
|
+
"6ea73faa8fc5aac76bded7bd238f6433"
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
test_emulation!(
|
|
109
|
+
test_firefox_152,
|
|
110
|
+
Emulation::Firefox152,
|
|
111
|
+
["t13d1617h2_86a278354501_3cbfd9057e0d"],
|
|
112
|
+
"6ea73faa8fc5aac76bded7bd238f6433"
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
/// Firefox 147 changed the generated `Accept-Language` q-value: the list used to divide 1.0
|
|
116
|
+
/// across its entries, giving `q=0.5` for two, and now decrements by 0.1 per entry, giving
|
|
117
|
+
/// `q=0.9`. See Bugzilla 2000765, landed in mozilla-firefox 0e050ae5116d.
|
|
118
|
+
///
|
|
119
|
+
/// Every profile is listed rather than a range, so adding one is a deliberate choice about
|
|
120
|
+
/// which side of 147 it falls on.
|
|
121
|
+
#[test]
|
|
122
|
+
fn firefox_accept_language_matches_the_profile_version() {
|
|
123
|
+
use wreq::IntoEmulation;
|
|
124
|
+
use wreq_util::{Platform, Profile};
|
|
125
|
+
|
|
126
|
+
const PRE_147: &[(&str, Profile)] = &[
|
|
127
|
+
("Firefox109", Emulation::Firefox109),
|
|
128
|
+
("Firefox117", Emulation::Firefox117),
|
|
129
|
+
("Firefox128", Emulation::Firefox128),
|
|
130
|
+
("Firefox133", Emulation::Firefox133),
|
|
131
|
+
("Firefox135", Emulation::Firefox135),
|
|
132
|
+
("FirefoxPrivate135", Emulation::FirefoxPrivate135),
|
|
133
|
+
("FirefoxAndroid135", Emulation::FirefoxAndroid135),
|
|
134
|
+
("Firefox136", Emulation::Firefox136),
|
|
135
|
+
("FirefoxPrivate136", Emulation::FirefoxPrivate136),
|
|
136
|
+
("Firefox139", Emulation::Firefox139),
|
|
137
|
+
("Firefox142", Emulation::Firefox142),
|
|
138
|
+
("Firefox143", Emulation::Firefox143),
|
|
139
|
+
("Firefox144", Emulation::Firefox144),
|
|
140
|
+
("Firefox145", Emulation::Firefox145),
|
|
141
|
+
("Firefox146", Emulation::Firefox146),
|
|
142
|
+
];
|
|
143
|
+
const POST_147: &[(&str, Profile)] = &[
|
|
144
|
+
("Firefox147", Emulation::Firefox147),
|
|
145
|
+
("Firefox148", Emulation::Firefox148),
|
|
146
|
+
("Firefox149", Emulation::Firefox149),
|
|
147
|
+
("Firefox150", Emulation::Firefox150),
|
|
148
|
+
("Firefox151", Emulation::Firefox151),
|
|
149
|
+
("Firefox152", Emulation::Firefox152),
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
fn accept_language(profile: Profile) -> String {
|
|
153
|
+
Emulation::builder()
|
|
154
|
+
.profile(profile)
|
|
155
|
+
.platform(Platform::Linux)
|
|
156
|
+
.build()
|
|
157
|
+
.into_emulation()
|
|
158
|
+
.headers
|
|
159
|
+
.get("accept-language")
|
|
160
|
+
.and_then(|value| value.to_str().ok())
|
|
161
|
+
.unwrap_or_default()
|
|
162
|
+
.to_owned()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
for (name, profile) in PRE_147 {
|
|
166
|
+
assert_eq!("en-US,en;q=0.5", accept_language(*profile), "{name}");
|
|
167
|
+
}
|
|
168
|
+
for (name, profile) in POST_147 {
|
|
169
|
+
assert_eq!("en-US,en;q=0.9", accept_language(*profile), "{name}");
|
|
170
|
+
}
|
|
171
|
+
}
|
data/lib/wreq_ruby/emulate.rb
CHANGED
|
@@ -65,6 +65,7 @@ module Wreq
|
|
|
65
65
|
Chrome151 = nil
|
|
66
66
|
Chrome152 = nil
|
|
67
67
|
Chrome153 = nil
|
|
68
|
+
Chrome154 = nil
|
|
68
69
|
|
|
69
70
|
Edge101 = nil
|
|
70
71
|
Edge122 = nil
|
|
@@ -106,6 +107,7 @@ module Wreq
|
|
|
106
107
|
Firefox149 = nil
|
|
107
108
|
Firefox150 = nil
|
|
108
109
|
Firefox151 = nil
|
|
110
|
+
Firefox152 = nil
|
|
109
111
|
|
|
110
112
|
SafariIos17_2 = nil
|
|
111
113
|
SafariIos17_4_1 = nil
|
data/src/emulate.rs
CHANGED
|
@@ -90,6 +90,7 @@ define_ruby_enum!(
|
|
|
90
90
|
Chrome151,
|
|
91
91
|
Chrome152,
|
|
92
92
|
Chrome153,
|
|
93
|
+
Chrome154,
|
|
93
94
|
|
|
94
95
|
Edge101,
|
|
95
96
|
Edge122,
|
|
@@ -131,6 +132,7 @@ define_ruby_enum!(
|
|
|
131
132
|
Firefox149,
|
|
132
133
|
Firefox150,
|
|
133
134
|
Firefox151,
|
|
135
|
+
Firefox152,
|
|
134
136
|
|
|
135
137
|
SafariIos17_2,
|
|
136
138
|
SafariIos17_4_1,
|
data/test/emulation_test.rb
CHANGED
|
@@ -18,10 +18,12 @@ class EmulationTest < Minitest::Test
|
|
|
18
18
|
assert_instance_of Wreq::Emulation, Wreq::Emulation.new(profile: profile)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def test_new_browser_profiles_are_available
|
|
22
22
|
{
|
|
23
23
|
Wreq::Profile::Chrome152 => "Chrome152",
|
|
24
|
-
Wreq::Profile::Chrome153 => "Chrome153"
|
|
24
|
+
Wreq::Profile::Chrome153 => "Chrome153",
|
|
25
|
+
Wreq::Profile::Chrome154 => "Chrome154",
|
|
26
|
+
Wreq::Profile::Firefox152 => "Firefox152"
|
|
25
27
|
}.each do |profile, name|
|
|
26
28
|
assert_equal name, profile.to_s
|
|
27
29
|
assert_instance_of Wreq::Emulation, Wreq::Emulation.new(profile: profile)
|