wreq 1.2.15 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb297a1d40048f6a29833fe7eb1a8248e1460825be97802d82aece4e922b1b6a
4
- data.tar.gz: eb8042d063690fa100cc63249f041e17724b5e8113c0611acb8c819d4ecc2afd
3
+ metadata.gz: e05412727cca397064368fd0c6f79c77efced70c13467850aad2cc4941aeeb9f
4
+ data.tar.gz: d5c40280a601d1ead2e79f647ce737bb6f442ed750d04eca609803c1d403dce6
5
5
  SHA512:
6
- metadata.gz: 3e781f223de45ef1ad4b92c17d2af10e2060a2de89e940a69d5a4cab4fd3a8e3ec96c96d1553ab22bc782304596a2bc15403124b324e0dbc4fab41c48256212e
7
- data.tar.gz: ca634efa4d997c7f96099929ff3b5163cc2fb236d9ba49f8502a99811dda441636ed05b1d05c89e58e1ee4e8954a97a47420963fe4f568c7cd4682f194c6adf2
6
+ metadata.gz: fef4a8ba4a3be468852f69a2d54f8ae2a4b33acdba75258836593ce263ff92993070ad1f5c43db07b5f45f5c0b72d7ca801667c2612238f0797d87faa95271b0
7
+ data.tar.gz: a7681af7b04813bb2826eb04b47b4ebb9af9343897f85b241cc7b61756c180ac2712530180044b1d1558a827b8da1032d9e3a8a64e0a7193f24fc31f96470d41
data/Cargo.lock CHANGED
@@ -1490,7 +1490,7 @@ dependencies = [
1490
1490
 
1491
1491
  [[package]]
1492
1492
  name = "wreq-ruby"
1493
- version = "1.2.15"
1493
+ version = "1.2.16"
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.2.15"
8
+ version = "1.2.16"
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` |
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
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` |
@@ -12,6 +12,7 @@ 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.
15
16
  - *(emulate)* Add Firefox 152 profile.
16
17
 
17
18
  ### Fixed
@@ -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.insert(
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("en-US,en;q=0.5"));
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
+ }
@@ -380,7 +380,7 @@ mod_generator!(
380
380
  mod_generator!(
381
381
  ff147,
382
382
  ff135::build_emulation,
383
- header_initializer_with_zstd,
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
- header_initializer_with_zstd,
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
- header_initializer_with_zstd,
439
+ header_initializer_with_zstd_q09,
440
440
  [
441
441
  (
442
442
  Windows,
@@ -465,7 +465,7 @@ mod_generator!(
465
465
  ff150,
466
466
  tls_options!(4, CIPHER_LIST_3, CURVES_2, KEY_SHARES_2),
467
467
  http2_options!(1),
468
- header_initializer_with_zstd,
468
+ header_initializer_with_zstd_q09,
469
469
  [
470
470
  (
471
471
  Windows,
@@ -493,7 +493,7 @@ mod_generator!(
493
493
  mod_generator!(
494
494
  ff151,
495
495
  ff150::build_emulation,
496
- header_initializer_with_zstd,
496
+ header_initializer_with_zstd_q09,
497
497
  [
498
498
  (
499
499
  Windows,
@@ -521,7 +521,7 @@ mod_generator!(
521
521
  mod_generator!(
522
522
  ff152,
523
523
  ff150::build_emulation,
524
- header_initializer_with_zstd,
524
+ header_initializer_with_zstd_q09,
525
525
  [
526
526
  (
527
527
  Windows,
@@ -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),
@@ -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
+ );
@@ -111,3 +111,61 @@ test_emulation!(
111
111
  ["t13d1617h2_86a278354501_3cbfd9057e0d"],
112
112
  "6ea73faa8fc5aac76bded7bd238f6433"
113
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
+ }
@@ -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
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,
@@ -22,6 +22,7 @@ class EmulationTest < Minitest::Test
22
22
  {
23
23
  Wreq::Profile::Chrome152 => "Chrome152",
24
24
  Wreq::Profile::Chrome153 => "Chrome153",
25
+ Wreq::Profile::Chrome154 => "Chrome154",
25
26
  Wreq::Profile::Firefox152 => "Firefox152"
26
27
  }.each do |profile, name|
27
28
  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.2.15
4
+ version: 1.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - SearchApi