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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a684244b1b3a988034a958ba6d5be4bd1c3233a958834eb103cabf8b57c7c7d2
4
- data.tar.gz: 2246ef7c885c1d4c429b1a0630795b8fe24bd1923dd4205267dd727ff552bb90
3
+ metadata.gz: 898cbb3c1d97282a298a19787eb18a53afac57e3b426703f92bc32747c264024
4
+ data.tar.gz: a8df8ecff52ab3945b481eeab0b4f0670c07c48c5fb6769513c16faeb9ff23e3
5
5
  SHA512:
6
- metadata.gz: 4a1e164422249f5cc1df7d1259879e640c4e822ef3e9e2d0d67c11128e7f90c023119ddb6d1610a098b1d2c43657f72cdf0f0780f29f80f81e58be6b2cf66f72
7
- data.tar.gz: 8298504fd0e17008572c3d0a7ed0ee1ef949bbce9c88a73729fcece75ba87fb54c43ce38fa1ae961fcf297db8e0c2ca58b528155d14aac588ee23499255b860e
6
+ metadata.gz: 41115ca950b1600c68b8204b5f3bbb1ea83311e73b9cc590d31d3f081e5920a5340978a96c9942296ee7094200743e4c9fa00d64554070507edd370c37524c58
7
+ data.tar.gz: 21ed5cbac98e76e864556ec523d837a675e19f14650e6af84380386892059b1401fde79631ec0c2bb098decd1b4c9716b675a9f851601052fca17f7019932b81
data/Cargo.lock CHANGED
@@ -1490,7 +1490,7 @@ dependencies = [
1490
1490
 
1491
1491
  [[package]]
1492
1492
  name = "wreq-ruby"
1493
- version = "1.3.0"
1493
+ version = "1.3.1"
1494
1494
  dependencies = [
1495
1495
  "arc-swap",
1496
1496
  "bytes",
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.0"
8
+ version = "1.3.1"
9
9
  rust-version = "1.98"
10
10
 
11
11
  [lib]
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 profile == crate::Profile::Chrome154 {
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 sorts the IDs by their raw bytes instead.
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
+ );
@@ -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 sorts those IDs by their raw bytes instead. Reusing this object
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
- # uses raw-byte sorted order. See {Emulation} for connection semantics.
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
@@ -92,6 +92,7 @@ define_ruby_enum!(
92
92
  Chrome152,
93
93
  Chrome153,
94
94
  Chrome154,
95
+ Chrome155,
95
96
 
96
97
  Edge101,
97
98
  Edge122,
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wreq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SearchApi