wreq 1.2.16-aarch64-linux → 1.3.0-aarch64-linux

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: 72b66a73489b44c20e3103c6d92e202bf11a3465689fad7ad52e74455f31c51c
4
- data.tar.gz: dbfe1d73a74d7724883bb822466f802c7b19fc0c693a2b6f934178647dd4512d
3
+ metadata.gz: f87dcba7562a09b49de04dcae968bc9f2d43c588b0d0bff67c3a28a4dc756fdb
4
+ data.tar.gz: 4a23583bbee6e0cd44bb6116b9afbfbd3836d0dea6d6f7f9099399d23ba324f9
5
5
  SHA512:
6
- metadata.gz: ff68b2fbf55cf6bd3d24be6b19ac00aab402c2b141b1fcb16668293d0e12f7e8540c7750b3a051e182c094bba34d0095d1cfeaadb1de97c7fd21e58516741da6
7
- data.tar.gz: b522e354da311bd02e5f50539ffc1d0fc344d7f0349a4a963f6872f05e0860330d1896b46db4c3ca4cb0c655b87f74ebb1e1a37b1b7a214dd13f5d8c6c568435
6
+ metadata.gz: ff0a87e6380582952797fff88c6a49b208fa328119b5a2844520e55703b05b3bc845f3dd799a95b83e83595e0e4484b5bc5294582ba259bbf51ee134947127c2
7
+ data.tar.gz: 8e5ec7df1c34be96b97d102f0ac037a038b036e8e649e71b27ef602646b3cf941f194fd4def577f93c0c0be336cdf201307dac963875333c4474f3e3386e63d3
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
17
 
18
18
  ### Fixed
19
19
 
20
+ - Match Trust Anchor ID ordering by Chrome version: randomized per native configuration for 152/153, and sorted by raw ID bytes for 154.
21
+
20
22
  - *(emulate)* Fix Firefox 150 and 151 cipher suite lists.
21
23
 
22
24
  ## [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
Binary file
Binary file
Binary file
@@ -264,6 +264,14 @@ module Wreq
264
264
  # for HTTP/2 and automatic default headers. The actual implementation is
265
265
  # provided by Rust.
266
266
  #
267
+ # Construction generates the native configuration once. For Chrome 152/153,
268
+ # 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
+ # across clients or requests retains that order. Creating a new object generates
271
+ # a new configuration, including a fresh shuffle for Chrome 152/153.
272
+ # This does not freeze other per-handshake randomness or force a new handshake
273
+ # when a request reuses an existing connection.
274
+ #
267
275
  # `profile:` defaults to the library's default profile when omitted.
268
276
  # `platform:` defaults to the library's default platform when omitted.
269
277
  #
@@ -289,6 +297,10 @@ module Wreq
289
297
  # Native fields and methods are set by the extension.
290
298
  # This stub is for documentation only.
291
299
  unless singleton_methods(false).include?(:new)
300
+ # 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.
303
+ #
292
304
  # @param profile [Wreq::Profile, nil] Fingerprint profile to emulate
293
305
  # @param platform [Wreq::Platform, nil] Operating system platform to emulate
294
306
  # @param http2 [Boolean, nil] Whether HTTP/2 emulation is enabled; defaults
@@ -1,8 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "test_helper"
4
+ require "socket"
5
+ require "stringio"
6
+ require "timeout"
4
7
 
5
8
  class EmulationTest < Minitest::Test
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|
11
+ emulation = Wreq::Emulation.new(profile: profile)
12
+ client = Wreq::Client.new(emulation: emulation, no_proxy: true)
13
+ expected = capture_trust_anchors { |url| client.get(url, timeout: 5) }
14
+ refute_empty expected, profile.to_s
15
+
16
+ request_client = Wreq::Client.new(no_proxy: true)
17
+ 2.times do
18
+ actual = capture_trust_anchors do |url|
19
+ request_client.get(url, emulation: emulation, timeout: 5)
20
+ end
21
+ assert_equal expected, actual, "#{profile}: reusing an object must retain its configuration"
22
+ end
23
+ end
24
+ end
25
+
6
26
  def test_all_emulation_device_constants_are_non_nil
7
27
  Wreq::Profile.constants.each do |name|
8
28
  const = Wreq::Profile.const_get(name)
@@ -37,4 +57,60 @@ class EmulationTest < Minitest::Test
37
57
  "#{name} should be Platform, got #{const.inspect}"
38
58
  end
39
59
  end
60
+
61
+ private
62
+
63
+ # Each listener forces a new connection. Stop after ClientHello so this test
64
+ # inspects the extension bytes without depending on certificates or the network.
65
+ def capture_trust_anchors
66
+ server = TCPServer.new("127.0.0.1", 0)
67
+ thread = Thread.new do
68
+ socket = nil
69
+ Timeout.timeout(5) do
70
+ socket = server.accept
71
+ handshake = +"".b
72
+ loop do
73
+ header = read_tls_bytes(socket, 5)
74
+ raise "expected a TLS handshake record" unless header.getbyte(0) == 22
75
+ handshake << read_tls_bytes(socket, header.byteslice(3, 2).unpack1("n"))
76
+ next if handshake.bytesize < 4
77
+ length = handshake.byteslice(1, 3).bytes.reduce(0) { |n, byte| (n << 8) | byte }
78
+ break if handshake.bytesize >= length + 4
79
+ end
80
+ trust_anchors_from_client_hello(handshake)
81
+ end
82
+ ensure
83
+ socket&.close
84
+ end
85
+ thread.report_on_exception = false
86
+
87
+ assert_raises(Wreq::ConnectionError) { yield "https://127.0.0.1:#{server.addr[1]}/" }
88
+ thread.value
89
+ ensure
90
+ server&.close
91
+ thread&.kill if thread&.alive?
92
+ thread&.join
93
+ end
94
+
95
+ def read_tls_bytes(io, length)
96
+ bytes = io.read(length)
97
+ raise EOFError, "truncated ClientHello" unless bytes&.bytesize == length
98
+ bytes
99
+ end
100
+
101
+ def trust_anchors_from_client_hello(handshake)
102
+ io = StringIO.new(handshake)
103
+ raise "expected ClientHello" unless read_tls_bytes(io, 1).unpack1("C") == 1
104
+ read_tls_bytes(io, 3 + 2 + 32) # Handshake length, legacy version and random.
105
+ read_tls_bytes(io, read_tls_bytes(io, 1).unpack1("C")) # Session ID.
106
+ read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")) # Cipher suites.
107
+ read_tls_bytes(io, read_tls_bytes(io, 1).unpack1("C")) # Compression methods.
108
+ extensions = StringIO.new(read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")))
109
+ until extensions.eof?
110
+ type, length = read_tls_bytes(extensions, 4).unpack("nn")
111
+ data = read_tls_bytes(extensions, length)
112
+ return data if type == 51764
113
+ end
114
+ raise "missing trust_anchors extension"
115
+ end
40
116
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wreq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.16
4
+ version: 1.3.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - SearchApi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-21 00:00:00.000000000 Z
11
+ date: 2026-09-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An easy and powerful Ruby HTTP client with advanced browser fingerprinting
14
14
  that accurately emulates Chrome, Edge, Firefox, Safari, Opera, and OkHttp with precise