wreq 1.3.2.2-aarch64-linux → 1.3.2.3-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 +4 -4
- data/README.md +11 -4
- data/VERSION +1 -1
- data/lib/wreq_ruby/3.3/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/3.4/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/4.0/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/emulate.rb +27 -0
- data/test/emulation_client_hello_test.rb +142 -0
- data/test/emulation_test.rb +21 -105
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4542c260dc34db62d1209ce6f1c64f339b3899d0540842b45de0b164c59d30d8
|
|
4
|
+
data.tar.gz: 1040d9f73b3af0e5ab933949c20a0dd9e29c3af56e644b847964de6fa21d6d74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2d02146ea2f98ed2f7bb4e0e6760e0f906288a550259e82061918ce680d7ecfa4c113f218b3d00e6b8058f15a7c4870ab628d48c1ca719940ab419040d079b7
|
|
7
|
+
data.tar.gz: de638a19a58f410e023b4a2fff3dabd0c7d830eba0dded77c3ea66ddd714c2fefc49fefe6b213c83a491b5d6f73b90fc37b46df678ef159f9b4132ab997c2bf3
|
data/README.md
CHANGED
|
@@ -89,14 +89,21 @@ Most browser device models share identical TLS and HTTP/2 configurations, differ
|
|
|
89
89
|
- <details>
|
|
90
90
|
<summary>Available browser emulations</summary>
|
|
91
91
|
|
|
92
|
+
Edge 149–158 provide request-header presets for Windows, macOS, Linux, Android, and iOS.
|
|
93
|
+
Firefox 153–160 provide Android and iPhone presets for `User-Agent` and `Accept-Language`.
|
|
94
|
+
Both use the same TLS and HTTP/2 settings as the corresponding desktop Firefox preset.
|
|
95
|
+
Opera 116–140 provide desktop request-header presets for Windows, macOS, and Linux.
|
|
96
|
+
|
|
92
97
|
| **Browser** | **Versions** |
|
|
93
98
|
| ----------- | ------------ |
|
|
94
99
|
| **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`, `Chrome156`, `Chrome157`, `Chrome158` |
|
|
95
|
-
| **Edge** | `Edge101`, `Edge122`, `Edge127`, `Edge131`, `Edge134
|
|
96
|
-
| **Firefox** | `Firefox109`, `Firefox117`, `Firefox128`, `Firefox133`, `Firefox135`, `FirefoxPrivate135`, `FirefoxAndroid135`, `Firefox136`, `FirefoxPrivate136`, `Firefox139`, `Firefox142`, `Firefox143`, `Firefox144`, `Firefox145`, `Firefox146`, `Firefox147`, `Firefox148`, `Firefox149`, `Firefox150`, `Firefox151`, `Firefox152` |
|
|
100
|
+
| **Edge** | `Edge101`, `Edge122`, `Edge127`, `Edge131`, `Edge134`–`Edge158` |
|
|
101
|
+
| **Firefox** | `Firefox109`, `Firefox117`, `Firefox128`, `Firefox133`, `Firefox135`, `FirefoxPrivate135`, `FirefoxAndroid135`, `Firefox136`, `FirefoxPrivate136`, `Firefox139`, `Firefox142`, `Firefox143`, `Firefox144`, `Firefox145`, `Firefox146`, `Firefox147`, `Firefox148`, `Firefox149`, `Firefox150`, `Firefox151`, `Firefox152`, `Firefox153`–`Firefox160` |
|
|
97
102
|
| **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
|
-
| **OkHttp** | `
|
|
99
|
-
| **Opera** | `Opera116
|
|
103
|
+
| **OkHttp** | `OkHttp3_9`, `OkHttp3_11`, `OkHttp3_13`, `OkHttp3_14`, `OkHttp4_9`, `OkHttp4_10`, `OkHttp4_12`, `OkHttp5` |
|
|
104
|
+
| **Opera** | `Opera116`–`Opera140` |
|
|
105
|
+
|
|
106
|
+
Opera 132–140 use the corresponding Chromium desktop TLS and HTTP/2 defaults with Opera-branded request headers.
|
|
100
107
|
|
|
101
108
|
</details>
|
|
102
109
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.2.
|
|
1
|
+
1.3.2.3
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/wreq_ruby/emulate.rb
CHANGED
|
@@ -90,6 +90,16 @@ module Wreq
|
|
|
90
90
|
Edge146 = nil
|
|
91
91
|
Edge147 = nil
|
|
92
92
|
Edge148 = nil
|
|
93
|
+
Edge149 = nil
|
|
94
|
+
Edge150 = nil
|
|
95
|
+
Edge151 = nil
|
|
96
|
+
Edge152 = nil
|
|
97
|
+
Edge153 = nil
|
|
98
|
+
Edge154 = nil
|
|
99
|
+
Edge155 = nil
|
|
100
|
+
Edge156 = nil
|
|
101
|
+
Edge157 = nil
|
|
102
|
+
Edge158 = nil
|
|
93
103
|
|
|
94
104
|
Firefox109 = nil
|
|
95
105
|
Firefox117 = nil
|
|
@@ -112,6 +122,14 @@ module Wreq
|
|
|
112
122
|
Firefox150 = nil
|
|
113
123
|
Firefox151 = nil
|
|
114
124
|
Firefox152 = nil
|
|
125
|
+
Firefox153 = nil
|
|
126
|
+
Firefox154 = nil
|
|
127
|
+
Firefox155 = nil
|
|
128
|
+
Firefox156 = nil
|
|
129
|
+
Firefox157 = nil
|
|
130
|
+
Firefox158 = nil
|
|
131
|
+
Firefox159 = nil
|
|
132
|
+
Firefox160 = nil
|
|
115
133
|
|
|
116
134
|
SafariIos17_2 = nil
|
|
117
135
|
SafariIos17_4_1 = nil
|
|
@@ -168,6 +186,15 @@ module Wreq
|
|
|
168
186
|
Opera129 = nil
|
|
169
187
|
Opera130 = nil
|
|
170
188
|
Opera131 = nil
|
|
189
|
+
Opera132 = nil
|
|
190
|
+
Opera133 = nil
|
|
191
|
+
Opera134 = nil
|
|
192
|
+
Opera135 = nil
|
|
193
|
+
Opera136 = nil
|
|
194
|
+
Opera137 = nil
|
|
195
|
+
Opera138 = nil
|
|
196
|
+
Opera139 = nil
|
|
197
|
+
Opera140 = nil
|
|
171
198
|
end
|
|
172
199
|
|
|
173
200
|
unless method_defined?(:to_s)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
require "socket"
|
|
5
|
+
require "stringio"
|
|
6
|
+
require "timeout"
|
|
7
|
+
|
|
8
|
+
class EmulationClientHelloTest < Minitest::Test
|
|
9
|
+
SUPPORTED_GROUPS = 10
|
|
10
|
+
SIGNATURE_ALGORITHMS = 13
|
|
11
|
+
KEY_SHARE = 51
|
|
12
|
+
TRUST_ANCHOR_IDS = 51_764
|
|
13
|
+
ENCRYPTED_CLIENT_HELLO = 65_037
|
|
14
|
+
|
|
15
|
+
def test_reusing_chrome_emulation_preserves_trust_anchors
|
|
16
|
+
[Wreq::Profile::Chrome152, Wreq::Profile::Chrome153, Wreq::Profile::Chrome154, Wreq::Profile::Chrome155, Wreq::Profile::Chrome156, Wreq::Profile::Chrome157].each do |profile|
|
|
17
|
+
emulation = Wreq::Emulation.new(profile: profile)
|
|
18
|
+
client = Wreq::Client.new(emulation: emulation, no_proxy: true)
|
|
19
|
+
_, extensions = capture_client_hello { |url| client.get(url, timeout: 5) }
|
|
20
|
+
expected = extensions.fetch(TRUST_ANCHOR_IDS)
|
|
21
|
+
refute_empty expected, profile.to_s
|
|
22
|
+
|
|
23
|
+
request_client = Wreq::Client.new(no_proxy: true)
|
|
24
|
+
2.times do
|
|
25
|
+
_, actual_extensions = capture_client_hello do |url|
|
|
26
|
+
request_client.get(url, emulation: emulation, timeout: 5)
|
|
27
|
+
end
|
|
28
|
+
assert_equal expected, actual_extensions.fetch(TRUST_ANCHOR_IDS), "#{profile}: reusing an object must retain its configuration"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_edge158_sends_signature_grease_without_trust_anchors
|
|
34
|
+
client = Wreq::Client.new(emulation: Wreq::Emulation.new(profile: Wreq::Profile::Edge158), no_proxy: true)
|
|
35
|
+
_, extensions = capture_client_hello { |url| client.get(url, timeout: 5) }
|
|
36
|
+
|
|
37
|
+
_, grease, *signatures = extensions.fetch(SIGNATURE_ALGORITHMS).unpack("n*")
|
|
38
|
+
assert_equal 0x0a0a, grease & 0x0f0f
|
|
39
|
+
assert_equal grease >> 8, grease & 0xff
|
|
40
|
+
assert_equal [0x0904, 0x0905, 0x0906], signatures.first(3) # ML-DSA
|
|
41
|
+
refute extensions.key?(TRUST_ANCHOR_IDS)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_firefox_client_hello_matches_version
|
|
45
|
+
suites_153 = [
|
|
46
|
+
0x1301, 0x1303, 0x1302,
|
|
47
|
+
0xc02b, 0xc02f, 0xcca9, 0xcca8, 0xc02c, 0xc030, 0xc00a, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035
|
|
48
|
+
]
|
|
49
|
+
# Firefox 154 disabled TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA.
|
|
50
|
+
suites_154 = suites_153.reject { |suite| suite == 0xc00a }
|
|
51
|
+
|
|
52
|
+
[
|
|
53
|
+
[Wreq::Profile::Firefox153, suites_153, 15, [4588, 29, 23, 24, 25, 256, 257]],
|
|
54
|
+
[Wreq::Profile::Firefox154, suites_154, 15, [4588, 29, 23, 24, 25, 256, 257]],
|
|
55
|
+
[Wreq::Profile::Firefox155, suites_154, 16, [4588, 29, 23, 24, 25, 256, 257]],
|
|
56
|
+
[Wreq::Profile::Firefox156, suites_154, 16, [4588, 29, 23, 24, 25]]
|
|
57
|
+
].each do |profile, expected_suites, padding_remainder, groups|
|
|
58
|
+
client = Wreq::Client.new(emulation: Wreq::Emulation.new(profile: profile), no_proxy: true)
|
|
59
|
+
suites, extensions = capture_client_hello { |url| client.get(url, timeout: 5) }
|
|
60
|
+
assert_equal [4588, 29, 23], key_share_groups(extensions.fetch(KEY_SHARE)), "#{profile}: key share groups"
|
|
61
|
+
assert_equal expected_suites, suites, "#{profile}: cipher suites"
|
|
62
|
+
|
|
63
|
+
assert_equal padding_remainder, ech_payload_size(extensions.fetch(ENCRYPTED_CLIENT_HELLO)) % 32, "#{profile}: ECH GREASE ciphertext"
|
|
64
|
+
assert_equal groups, extensions.fetch(SUPPORTED_GROUPS).unpack("n*").drop(1), "#{profile}: supported groups"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
# Each listener forces a new connection. Stop after ClientHello so this test
|
|
71
|
+
# inspects the wire bytes without depending on certificates or an external service.
|
|
72
|
+
def capture_client_hello
|
|
73
|
+
server = TCPServer.new("127.0.0.1", 0)
|
|
74
|
+
thread = Thread.new do
|
|
75
|
+
socket = nil
|
|
76
|
+
Timeout.timeout(5) do
|
|
77
|
+
socket = server.accept
|
|
78
|
+
handshake = +"".b
|
|
79
|
+
loop do
|
|
80
|
+
header = read_tls_bytes(socket, 5)
|
|
81
|
+
raise "expected a TLS handshake record" unless header.getbyte(0) == 22
|
|
82
|
+
handshake << read_tls_bytes(socket, header.byteslice(3, 2).unpack1("n"))
|
|
83
|
+
next if handshake.bytesize < 4
|
|
84
|
+
length = handshake.byteslice(1, 3).bytes.reduce(0) { |n, byte| (n << 8) | byte }
|
|
85
|
+
break if handshake.bytesize >= length + 4
|
|
86
|
+
end
|
|
87
|
+
parse_client_hello(handshake)
|
|
88
|
+
end
|
|
89
|
+
ensure
|
|
90
|
+
socket&.close
|
|
91
|
+
end
|
|
92
|
+
thread.report_on_exception = false
|
|
93
|
+
|
|
94
|
+
assert_raises(Wreq::ConnectionError) { yield "https://127.0.0.1:#{server.addr[1]}/" }
|
|
95
|
+
thread.value
|
|
96
|
+
ensure
|
|
97
|
+
server&.close
|
|
98
|
+
thread&.kill if thread&.alive?
|
|
99
|
+
thread&.join
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def read_tls_bytes(io, length)
|
|
103
|
+
bytes = io.read(length)
|
|
104
|
+
raise EOFError, "truncated ClientHello" unless bytes&.bytesize == length
|
|
105
|
+
bytes
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def parse_client_hello(handshake)
|
|
109
|
+
io = StringIO.new(handshake)
|
|
110
|
+
raise "expected ClientHello" unless read_tls_bytes(io, 1).unpack1("C") == 1
|
|
111
|
+
read_tls_bytes(io, 3 + 2 + 32) # Handshake length, legacy version and random.
|
|
112
|
+
read_tls_bytes(io, read_tls_bytes(io, 1).unpack1("C")) # Session ID.
|
|
113
|
+
suites = read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")).unpack("n*")
|
|
114
|
+
read_tls_bytes(io, read_tls_bytes(io, 1).unpack1("C")) # Compression methods.
|
|
115
|
+
extensions = StringIO.new(read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")))
|
|
116
|
+
parsed = {}
|
|
117
|
+
until extensions.eof?
|
|
118
|
+
type, length = read_tls_bytes(extensions, 4).unpack("nn")
|
|
119
|
+
parsed[type] = read_tls_bytes(extensions, length)
|
|
120
|
+
end
|
|
121
|
+
[suites, parsed]
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def ech_payload_size(extension)
|
|
125
|
+
io = StringIO.new(extension)
|
|
126
|
+
read_tls_bytes(io, 6) # Outer tag, HPKE suite and config ID.
|
|
127
|
+
read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")) # Encapsulated key.
|
|
128
|
+
read_tls_bytes(io, 2).unpack1("n")
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def key_share_groups(extension)
|
|
132
|
+
io = StringIO.new(extension)
|
|
133
|
+
entries = StringIO.new(read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")))
|
|
134
|
+
groups = []
|
|
135
|
+
until entries.eof?
|
|
136
|
+
group, length = read_tls_bytes(entries, 4).unpack("nn")
|
|
137
|
+
read_tls_bytes(entries, length) # Key exchange bytes.
|
|
138
|
+
groups << group
|
|
139
|
+
end
|
|
140
|
+
groups
|
|
141
|
+
end
|
|
142
|
+
end
|
data/test/emulation_test.rb
CHANGED
|
@@ -1,120 +1,36 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "test_helper"
|
|
4
|
-
require "socket"
|
|
5
|
-
require "stringio"
|
|
6
|
-
require "timeout"
|
|
7
4
|
|
|
8
5
|
class EmulationTest < Minitest::Test
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
26
|
-
def test_all_emulation_device_constants_are_non_nil
|
|
27
|
-
Wreq::Profile.constants.each do |name|
|
|
28
|
-
const = Wreq::Profile.const_get(name)
|
|
29
|
-
assert_instance_of Wreq::Profile, const,
|
|
30
|
-
"#{name} should be Profile, got #{const.inspect}"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_chrome151_profile_is_available
|
|
35
|
-
profile = Wreq::Profile::Chrome151
|
|
36
|
-
|
|
37
|
-
assert_equal "Chrome151", profile.to_s
|
|
38
|
-
assert_instance_of Wreq::Emulation, Wreq::Emulation.new(profile: profile)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def test_new_browser_profiles_are_available
|
|
42
|
-
{
|
|
43
|
-
Wreq::Profile::Chrome152 => "Chrome152",
|
|
44
|
-
Wreq::Profile::Chrome153 => "Chrome153",
|
|
45
|
-
Wreq::Profile::Chrome154 => "Chrome154",
|
|
46
|
-
Wreq::Profile::Chrome155 => "Chrome155",
|
|
47
|
-
Wreq::Profile::Chrome156 => "Chrome156",
|
|
48
|
-
Wreq::Profile::Chrome157 => "Chrome157",
|
|
49
|
-
Wreq::Profile::Chrome158 => "Chrome158",
|
|
50
|
-
Wreq::Profile::Firefox152 => "Firefox152"
|
|
51
|
-
}.each do |profile, name|
|
|
52
|
-
assert_equal name, profile.to_s
|
|
53
|
-
assert_instance_of Wreq::Emulation, Wreq::Emulation.new(profile: profile)
|
|
6
|
+
def test_expected_browser_profiles_are_registered
|
|
7
|
+
versions_by_browser = {
|
|
8
|
+
"Chrome" => 151..158,
|
|
9
|
+
"Edge" => [101, 122, 127, 131, *(134..158)],
|
|
10
|
+
"Firefox" => [109, 117, 128, 133, 135, 136, 139, *(142..160)],
|
|
11
|
+
"Opera" => 116..140
|
|
12
|
+
}
|
|
13
|
+
expected = versions_by_browser.flat_map do |browser, versions|
|
|
14
|
+
versions.map { |version| "#{browser}#{version}" }
|
|
54
15
|
end
|
|
55
|
-
|
|
16
|
+
expected.concat(%w[FirefoxPrivate135 FirefoxAndroid135 FirefoxPrivate136])
|
|
56
17
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const = Wreq::Platform.const_get(name)
|
|
60
|
-
assert_instance_of Wreq::Platform, const,
|
|
61
|
-
"#{name} should be Platform, got #{const.inspect}"
|
|
62
|
-
end
|
|
18
|
+
registered = Wreq::Profile.constants(false).map(&:to_s)
|
|
19
|
+
assert_empty expected - registered, "missing browser profiles"
|
|
63
20
|
end
|
|
64
21
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
thread = Thread.new do
|
|
72
|
-
socket = nil
|
|
73
|
-
Timeout.timeout(5) do
|
|
74
|
-
socket = server.accept
|
|
75
|
-
handshake = +"".b
|
|
76
|
-
loop do
|
|
77
|
-
header = read_tls_bytes(socket, 5)
|
|
78
|
-
raise "expected a TLS handshake record" unless header.getbyte(0) == 22
|
|
79
|
-
handshake << read_tls_bytes(socket, header.byteslice(3, 2).unpack1("n"))
|
|
80
|
-
next if handshake.bytesize < 4
|
|
81
|
-
length = handshake.byteslice(1, 3).bytes.reduce(0) { |n, byte| (n << 8) | byte }
|
|
82
|
-
break if handshake.bytesize >= length + 4
|
|
83
|
-
end
|
|
84
|
-
trust_anchors_from_client_hello(handshake)
|
|
85
|
-
end
|
|
86
|
-
ensure
|
|
87
|
-
socket&.close
|
|
22
|
+
def test_registered_profiles_have_matching_names_and_build_emulation
|
|
23
|
+
Wreq::Profile.constants(false).each do |name|
|
|
24
|
+
profile = Wreq::Profile.const_get(name, false)
|
|
25
|
+
assert_instance_of Wreq::Profile, profile, name.to_s
|
|
26
|
+
assert_equal name.to_s, profile.to_s
|
|
27
|
+
assert_instance_of Wreq::Emulation, Wreq::Emulation.new(profile: profile), name.to_s
|
|
88
28
|
end
|
|
89
|
-
thread.report_on_exception = false
|
|
90
|
-
|
|
91
|
-
assert_raises(Wreq::ConnectionError) { yield "https://127.0.0.1:#{server.addr[1]}/" }
|
|
92
|
-
thread.value
|
|
93
|
-
ensure
|
|
94
|
-
server&.close
|
|
95
|
-
thread&.kill if thread&.alive?
|
|
96
|
-
thread&.join
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def read_tls_bytes(io, length)
|
|
100
|
-
bytes = io.read(length)
|
|
101
|
-
raise EOFError, "truncated ClientHello" unless bytes&.bytesize == length
|
|
102
|
-
bytes
|
|
103
29
|
end
|
|
104
30
|
|
|
105
|
-
def
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
read_tls_bytes(io, 3 + 2 + 32) # Handshake length, legacy version and random.
|
|
109
|
-
read_tls_bytes(io, read_tls_bytes(io, 1).unpack1("C")) # Session ID.
|
|
110
|
-
read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")) # Cipher suites.
|
|
111
|
-
read_tls_bytes(io, read_tls_bytes(io, 1).unpack1("C")) # Compression methods.
|
|
112
|
-
extensions = StringIO.new(read_tls_bytes(io, read_tls_bytes(io, 2).unpack1("n")))
|
|
113
|
-
until extensions.eof?
|
|
114
|
-
type, length = read_tls_bytes(extensions, 4).unpack("nn")
|
|
115
|
-
data = read_tls_bytes(extensions, length)
|
|
116
|
-
return data if type == 51764
|
|
31
|
+
def test_registered_platforms_are_platform_values
|
|
32
|
+
Wreq::Platform.constants(false).each do |name|
|
|
33
|
+
assert_instance_of Wreq::Platform, Wreq::Platform.const_get(name, false), name.to_s
|
|
117
34
|
end
|
|
118
|
-
raise "missing trust_anchors extension"
|
|
119
35
|
end
|
|
120
36
|
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.3.2.
|
|
4
|
+
version: 1.3.2.3
|
|
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-11-
|
|
11
|
+
date: 2026-11-25 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
|
|
@@ -71,6 +71,7 @@ files:
|
|
|
71
71
|
- test/client_cookie_test.rb
|
|
72
72
|
- test/client_test.rb
|
|
73
73
|
- test/cookie_test.rb
|
|
74
|
+
- test/emulation_client_hello_test.rb
|
|
74
75
|
- test/emulation_test.rb
|
|
75
76
|
- test/error_handling_test.rb
|
|
76
77
|
- test/fork_test.rb
|