wreq 1.3.0 → 1.3.1
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 +1 -1
- data/crates/wreq-util/CHANGELOG.md +1 -0
- data/crates/wreq-util/src/emulate/profile/chrome/header.rs +14 -0
- data/crates/wreq-util/src/emulate/profile/chrome/tls.rs +5 -1
- data/crates/wreq-util/src/emulate/profile/chrome.rs +36 -0
- data/crates/wreq-util/src/emulate.rs +2 -1
- data/crates/wreq-util/tests/emulate_chrome.rs +10 -0
- data/lib/wreq_ruby/emulate.rb +4 -3
- data/src/emulate.rs +1 -0
- data/test/emulation_test.rb +2 -1
- 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: 898cbb3c1d97282a298a19787eb18a53afac57e3b426703f92bc32747c264024
|
|
4
|
+
data.tar.gz: a8df8ecff52ab3945b481eeab0b4f0670c07c48c5fb6769513c16faeb9ff23e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41115ca950b1600c68b8204b5f3bbb1ea83311e73b9cc590d31d3f081e5920a5340978a96c9942296ee7094200743e4c9fa00d64554070507edd370c37524c58
|
|
7
|
+
data.tar.gz: 21ed5cbac98e76e864556ec523d837a675e19f14650e6af84380386892059b1401fde79631ec0c2bb098decd1b4c9716b675a9f851601052fca17f7019932b81
|
data/Cargo.lock
CHANGED
data/Cargo.toml
CHANGED
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` |
|
|
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` |
|
|
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` |
|
|
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
13
13
|
- *(emulate)* Add Chrome 152 profile.
|
|
14
14
|
- *(emulate)* Add Chrome 153 profile.
|
|
15
15
|
- *(emulate)* Add Chrome 154 profile.
|
|
16
|
+
- *(emulate)* Add Chrome 155 profile, including the JPEG XL navigation Accept header.
|
|
16
17
|
- *(emulate)* Add Firefox 152 profile.
|
|
17
18
|
|
|
18
19
|
### Fixed
|
|
@@ -73,6 +73,20 @@ pub fn header_initializer_with_zstd_priority(
|
|
|
73
73
|
headers
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
pub fn header_initializer_chrome155(
|
|
77
|
+
sec_ch_ua: &'static str,
|
|
78
|
+
ua: &'static str,
|
|
79
|
+
emulation_os: Platform,
|
|
80
|
+
) -> HeaderMap {
|
|
81
|
+
let mut headers = header_initializer_with_zstd_priority(sec_ch_ua, ua, emulation_os);
|
|
82
|
+
// Chrome 155 enables JPEG XL in Blink; the iOS profile keeps its WebKit headers.
|
|
83
|
+
// https://chromium.googlesource.com/chromium/src/+/cfaadc5a132d78e1828635aa8405a499f3e14864/content/common/content_constants_internal.h
|
|
84
|
+
if !matches!(emulation_os, Platform::IOS) {
|
|
85
|
+
headers.insert(ACCEPT, HeaderValue::from_static("text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"));
|
|
86
|
+
}
|
|
87
|
+
headers
|
|
88
|
+
}
|
|
89
|
+
|
|
76
90
|
pub fn header_initializer_chrome152(
|
|
77
91
|
sec_ch_ua: &'static str,
|
|
78
92
|
ua: &'static str,
|
|
@@ -234,6 +234,7 @@ mod tests {
|
|
|
234
234
|
crate::Profile::Chrome152,
|
|
235
235
|
crate::Profile::Chrome153,
|
|
236
236
|
crate::Profile::Chrome154,
|
|
237
|
+
crate::Profile::Chrome155,
|
|
237
238
|
] {
|
|
238
239
|
let native = profile.into_emulation();
|
|
239
240
|
let cloned = native.clone();
|
|
@@ -243,7 +244,10 @@ mod tests {
|
|
|
243
244
|
let decoded = decode_ids(&ids);
|
|
244
245
|
let mut expected = chromium_roots::trust_anchor_ids();
|
|
245
246
|
expected.sort_unstable();
|
|
246
|
-
if
|
|
247
|
+
if matches!(
|
|
248
|
+
profile,
|
|
249
|
+
crate::Profile::Chrome154 | crate::Profile::Chrome155
|
|
250
|
+
) {
|
|
247
251
|
assert_eq!(decoded, expected);
|
|
248
252
|
}
|
|
249
253
|
let mut actual = decoded;
|
|
@@ -1963,6 +1963,42 @@ mod_generator!(
|
|
|
1963
1963
|
]
|
|
1964
1964
|
);
|
|
1965
1965
|
|
|
1966
|
+
// Chrome 155 retains Chrome 154's TLS/HTTP2 configuration. Its UA-CH permutation
|
|
1967
|
+
// and GREASE brand are seeded by major version 155.
|
|
1968
|
+
// https://chromium.googlesource.com/chromium/src/+/cfaadc5a132d78e1828635aa8405a499f3e14864/components/embedder_support/user_agent_utils.cc
|
|
1969
|
+
mod_generator!(
|
|
1970
|
+
v155,
|
|
1971
|
+
v154::build_emulation,
|
|
1972
|
+
header_initializer_chrome155,
|
|
1973
|
+
[
|
|
1974
|
+
(
|
|
1975
|
+
MacOS,
|
|
1976
|
+
r#""Google Chrome";v="155", "Chromium";v="155", "Not(A:Brand";v="24""#,
|
|
1977
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36"
|
|
1978
|
+
),
|
|
1979
|
+
(
|
|
1980
|
+
Linux,
|
|
1981
|
+
r#""Google Chrome";v="155", "Chromium";v="155", "Not(A:Brand";v="24""#,
|
|
1982
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36"
|
|
1983
|
+
),
|
|
1984
|
+
(
|
|
1985
|
+
Android,
|
|
1986
|
+
r#""Google Chrome";v="155", "Chromium";v="155", "Not(A:Brand";v="24""#,
|
|
1987
|
+
"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Mobile Safari/537.36"
|
|
1988
|
+
),
|
|
1989
|
+
(
|
|
1990
|
+
Windows,
|
|
1991
|
+
r#""Google Chrome";v="155", "Chromium";v="155", "Not(A:Brand";v="24""#,
|
|
1992
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36"
|
|
1993
|
+
),
|
|
1994
|
+
(
|
|
1995
|
+
IOS,
|
|
1996
|
+
r#""Google Chrome";v="155", "Chromium";v="155", "Not(A:Brand";v="24""#,
|
|
1997
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/155.0.8059.37 Mobile/15E148 Safari/604.1"
|
|
1998
|
+
)
|
|
1999
|
+
]
|
|
2000
|
+
);
|
|
2001
|
+
|
|
1966
2002
|
mod_generator!(
|
|
1967
2003
|
edge143,
|
|
1968
2004
|
v132::build_emulation,
|
|
@@ -65,6 +65,7 @@ define_enum!(
|
|
|
65
65
|
Chrome152 => ("chrome_152", v152::emulation),
|
|
66
66
|
Chrome153 => ("chrome_153", v153::emulation),
|
|
67
67
|
Chrome154 => ("chrome_154", v154::emulation),
|
|
68
|
+
Chrome155 => ("chrome_155", v155::emulation),
|
|
68
69
|
|
|
69
70
|
// Edge versions
|
|
70
71
|
Edge101 => ("edge_101", edge101::emulation),
|
|
@@ -220,7 +221,7 @@ impl Platform {
|
|
|
220
221
|
/// Conversion through [`wreq::IntoEmulation`] creates a native configuration,
|
|
221
222
|
/// including a randomized Trust Anchor ID order for Chrome 152/153 profiles.
|
|
222
223
|
/// Client-level emulation retains that order for subsequent connections.
|
|
223
|
-
/// Chrome 154
|
|
224
|
+
/// Chrome 154/155 sort the IDs by their raw bytes instead.
|
|
224
225
|
#[derive(Default, Clone, TypedBuilder)]
|
|
225
226
|
pub struct Emulation {
|
|
226
227
|
/// Whether to change the profile (browser/okhttp) information.
|
|
@@ -305,3 +305,13 @@ test_emulation!(
|
|
|
305
305
|
],
|
|
306
306
|
"52d84b11737d980aef856699f885ca86"
|
|
307
307
|
);
|
|
308
|
+
|
|
309
|
+
test_emulation!(
|
|
310
|
+
test_chrome155,
|
|
311
|
+
Emulation::Chrome155,
|
|
312
|
+
[
|
|
313
|
+
"t13d1517h2_8daaf6152771_cb7bf5808d99",
|
|
314
|
+
"t13d1518h2_8daaf6152771_e2d80978ab2e"
|
|
315
|
+
],
|
|
316
|
+
"52d84b11737d980aef856699f885ca86"
|
|
317
|
+
);
|
data/lib/wreq_ruby/emulate.rb
CHANGED
|
@@ -66,6 +66,7 @@ module Wreq
|
|
|
66
66
|
Chrome152 = nil
|
|
67
67
|
Chrome153 = nil
|
|
68
68
|
Chrome154 = nil
|
|
69
|
+
Chrome155 = nil
|
|
69
70
|
|
|
70
71
|
Edge101 = nil
|
|
71
72
|
Edge122 = nil
|
|
@@ -266,7 +267,7 @@ module Wreq
|
|
|
266
267
|
#
|
|
267
268
|
# Construction generates the native configuration once. For Chrome 152/153,
|
|
268
269
|
# the TLS trust_anchors extension's ID order is randomized at construction;
|
|
269
|
-
# Chrome 154
|
|
270
|
+
# Chrome 154/155 sort those IDs by their raw bytes instead. Reusing this object
|
|
270
271
|
# across clients or requests retains that order. Creating a new object generates
|
|
271
272
|
# a new configuration, including a fresh shuffle for Chrome 152/153.
|
|
272
273
|
# This does not freeze other per-handshake randomness or force a new handshake
|
|
@@ -298,8 +299,8 @@ module Wreq
|
|
|
298
299
|
# This stub is for documentation only.
|
|
299
300
|
unless singleton_methods(false).include?(:new)
|
|
300
301
|
# Generates a reusable native configuration. Chrome 152/153 Trust Anchor ID
|
|
301
|
-
# order is chosen here and retained when this object is reused; Chrome 154
|
|
302
|
-
#
|
|
302
|
+
# order is chosen here and retained when this object is reused; Chrome 154/155
|
|
303
|
+
# use raw-byte sorted order. See {Emulation} for connection semantics.
|
|
303
304
|
#
|
|
304
305
|
# @param profile [Wreq::Profile, nil] Fingerprint profile to emulate
|
|
305
306
|
# @param platform [Wreq::Platform, nil] Operating system platform to emulate
|
data/src/emulate.rs
CHANGED
data/test/emulation_test.rb
CHANGED
|
@@ -7,7 +7,7 @@ require "timeout"
|
|
|
7
7
|
|
|
8
8
|
class EmulationTest < Minitest::Test
|
|
9
9
|
def test_reused_emulation_retains_trust_anchors_across_clients_and_requests
|
|
10
|
-
[Wreq::Profile::Chrome152, Wreq::Profile::Chrome153, Wreq::Profile::Chrome154].each do |profile|
|
|
10
|
+
[Wreq::Profile::Chrome152, Wreq::Profile::Chrome153, Wreq::Profile::Chrome154, Wreq::Profile::Chrome155].each do |profile|
|
|
11
11
|
emulation = Wreq::Emulation.new(profile: profile)
|
|
12
12
|
client = Wreq::Client.new(emulation: emulation, no_proxy: true)
|
|
13
13
|
expected = capture_trust_anchors { |url| client.get(url, timeout: 5) }
|
|
@@ -43,6 +43,7 @@ class EmulationTest < Minitest::Test
|
|
|
43
43
|
Wreq::Profile::Chrome152 => "Chrome152",
|
|
44
44
|
Wreq::Profile::Chrome153 => "Chrome153",
|
|
45
45
|
Wreq::Profile::Chrome154 => "Chrome154",
|
|
46
|
+
Wreq::Profile::Chrome155 => "Chrome155",
|
|
46
47
|
Wreq::Profile::Firefox152 => "Firefox152"
|
|
47
48
|
}.each do |profile, name|
|
|
48
49
|
assert_equal name, profile.to_s
|