wreq 1.3.2.1-aarch64-linux → 1.3.5-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: 9c1ea2a6624e6cb27ea63594f5df5195a0e9c96cc29559443a2c75683c0ce915
4
- data.tar.gz: 837831e8129ae25c14e527779138b440dc91e0ce08fe36976252fd0a841beb61
3
+ metadata.gz: 45ad61657a00e07711b764f4fad6b2cadb0efd0ca2ac3854c5e247796b38c379
4
+ data.tar.gz: 18e91f0979a5b8dd2817623a955f9cb05df3538255cc9d4aab26b0e69b1be779
5
5
  SHA512:
6
- metadata.gz: 2feb6913b895a4ae757f32b0aa3c68e764036493876614e967008f82aac2c3ddb22acee814638218f4445460ced84546ddfe9befdb2dd354480b154bf3572a68
7
- data.tar.gz: 4f199ff5d612a628b5a56afd0a29bb3223d56e1c92989c9d6af944e59e255d1536f975f4f51b8a82fc7ffeb6dae1cdd75c448bd68658f40eaf2022b0b0aa6d0a
6
+ metadata.gz: 8fb555bc1da4ca7fbb9cc3e0d8dd86f1f50097c323224a27370f3b60ec2d9a85e46259e426e9204bb10b78c7e4a427d18f3b11b40a58c887b7e1bab8a4dd0d25
7
+ data.tar.gz: 5994c14fa896693fdb6a608acf6ae5f908f8e08f10ce350b05fb2e7d0fcbaf6508126f47cd370ab4e0e92a2de5cfc32f26061662fc3356499bb9c93ae75ce904
@@ -20,12 +20,14 @@ See the [crate documentation](https://docs.rs/wreq-util/latest/wreq_util) for mo
20
20
 
21
21
  ## Example
22
22
 
23
+ This vendored copy uses the development wreq revision pinned in the [root Cargo.toml](../../Cargo.toml). Building it independently requires the same Git patches.
24
+
23
25
  The following example uses the [Tokio](https://tokio.rs) runtime with optional features enabled by adding this to your `Cargo.toml`:
24
26
 
25
27
  ```toml
26
28
  [dependencies]
27
29
  tokio = { version = "1", features = ["full"] }
28
- wreq = "6.0.0-rc"
30
+ wreq = "0.16.1"
29
31
  wreq-util = "3.0.0-rc"
30
32
  ```
31
33
 
@@ -38,7 +40,7 @@ use wreq_util::Emulation;
38
40
  #[tokio::main]
39
41
  async fn main() -> wreq::Result<()> {
40
42
  // Build a client
41
- let client = Client::builder()
43
+ let client = Client::builder_tokio()
42
44
  .emulation(Emulation::Chrome147)
43
45
  .build()?;
44
46
 
Binary file
Binary file
Binary file
@@ -5,7 +5,7 @@ unless defined?(Wreq)
5
5
  # HTTP client with extensive configuration options.
6
6
  #
7
7
  # This class wraps a native Rust implementation providing high-performance
8
- # HTTP/1.1 and HTTP/2 client functionality with support for connection pooling,
8
+ # HTTP/1.1, HTTP/2 and HTTP/3 client functionality with support for connection pooling,
9
9
  # compression, redirects, proxies, and fine-grained timeout controls.
10
10
  #
11
11
  # The client is thread-safe and maintains an internal connection pool for
@@ -110,25 +110,37 @@ unless defined?(Wreq)
110
110
  # allowing the reuse of local addresses in TIME_WAIT state. Useful for
111
111
  # reducing port exhaustion in high-throughput scenarios.
112
112
  #
113
- # @param pool_idle_timeout [Integer, nil] Time in seconds before idle
114
- # connections in the pool are evicted and closed. Helps free up
115
- # resources for long-running applications.
113
+ # @param pool_idle_timeout [Integer, nil] Idle connection reuse timeout in
114
+ # seconds. Defaults to 90 when omitted or nil. Does not expire a busy
115
+ # HTTP/2 or HTTP/3 connection.
116
116
  #
117
- # @param pool_max_idle_per_host [Integer, nil] Maximum number of idle
118
- # connections to maintain per host in the connection pool. Connections
119
- # beyond this limit will be closed immediately after use.
117
+ # @param pool_max_idle_per_host [Integer, nil] Maximum idle HTTP/1
118
+ # connections retained per compatibility group, which includes the host
119
+ # and connection configuration. Defaults to unlimited when omitted or
120
+ # nil; 0 disables connection reuse. Does not limit active connections.
120
121
  #
121
- # @param pool_max_size [Integer, nil] Total maximum size of the connection
122
- # pool across all hosts. Once reached, new requests may need to wait
123
- # for existing connections to become available.
122
+ # @param pool_max_size [Integer, nil] Maximum compatibility groups retaining
123
+ # idle HTTP/1 or shared HTTP/2 and HTTP/3 connections. Defaults to unlimited
124
+ # when omitted, nil or 0. A full pool evicts the least recently used idle
125
+ # group; it does not make requests wait or limit physical connections.
124
126
  #
125
127
  # @param http1_only [Boolean, nil] Force the client to use HTTP/1.1 only,
126
128
  # even if HTTP/2 is available. Useful for compatibility with servers
127
- # that have problematic HTTP/2 implementations.
129
+ # that have problematic HTTP/2 implementations. Cannot be combined with
130
+ # http2_only or http3_only. An explicit request version overrides this
131
+ # preference.
128
132
  #
129
133
  # @param http2_only [Boolean, nil] Force the client to use HTTP/2 only.
130
134
  # Requests to servers that don't support HTTP/2 will fail. Cannot be
131
- # combined with http1_only.
135
+ # combined with http1_only or http3_only. An explicit request version
136
+ # overrides this preference, including HTTP/3 over QUIC.
137
+ #
138
+ # @param http3_only [Boolean, nil] Use HTTP/3 over QUIC without falling back
139
+ # to TCP. Defaults to false when omitted or nil. Requires HTTPS and UDP
140
+ # connectivity. Cannot be combined with http1_only or http2_only. An
141
+ # explicit HTTP/1 or HTTP/2 request version overrides this preference.
142
+ # HTTP/HTTPS proxies, including environment proxies, cannot carry HTTP/3;
143
+ # use no_proxy: true, a SOCKS5 UDP proxy, or a QUIC MASQUE proxy instead.
132
144
  #
133
145
  # @param https_only [Boolean, nil] Reject plain HTTP connections and
134
146
  # only allow HTTPS. Provides an additional layer of security by
@@ -149,7 +161,9 @@ unless defined?(Wreq)
149
161
  # environment.
150
162
  #
151
163
  # @param proxy [String, nil] Proxy server URI to use for all requests.
152
- # Supports HTTP, HTTPS, and SOCKS5 proxies. Format: "protocol://host:port"
164
+ # Supports HTTP, HTTPS, SOCKS and QUIC proxies. HTTP/3 can use SOCKS5 UDP
165
+ # ASSOCIATE or a `quic://` MASQUE proxy, but not HTTP CONNECT proxies.
166
+ # Format: "protocol://host:port"
153
167
  # Example: "http://proxy.example.com:8080"
154
168
  # @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable.
155
169
  # @param interface [String, nil] Bind sockets to a network interface on
@@ -267,6 +267,9 @@ module Wreq
267
267
  # for HTTP/2 and automatic default headers. The actual implementation is
268
268
  # provided by Rust.
269
269
  #
270
+ # Profiles configure TLS over TCP, HTTP/2 and request headers. They do not
271
+ # configure HTTP/3 or QUIC fingerprints; HTTP/3 uses the backend defaults.
272
+ #
270
273
  # Construction generates the native configuration once. For Chrome 152/153,
271
274
  # the TLS trust_anchors extension's ID order is randomized at construction;
272
275
  # Chrome 154 and later sort those IDs by their raw bytes instead. Reusing this object
@@ -42,7 +42,7 @@ module Wreq
42
42
 
43
43
  # Value-based equality. Returns true when both represent the same HTTP method.
44
44
  # @param other [Object]
45
- # @return [Boolean]
45
+ # @return [Boolean]
46
46
  unless method_defined?(:==)
47
47
  def ==(other)
48
48
  end
@@ -77,7 +77,14 @@ module Wreq
77
77
  HTTP_10 = nil # @return [Wreq::Version] HTTP/1.0
78
78
  HTTP_11 = nil # @return [Wreq::Version] HTTP/1.1
79
79
  HTTP_2 = nil # @return [Wreq::Version] HTTP/2
80
- HTTP_3 = nil # @return [Wreq::Version] HTTP/3
80
+ # Select HTTP/3 over QUIC with `version: Wreq::Version::HTTP_3` on a request.
81
+ # To use it by default, construct a client with `http3_only: true` instead.
82
+ # Requires an HTTPS URL and a reachable UDP endpoint. There is no automatic
83
+ # Alt-Svc discovery or fallback to HTTP/1.1 or HTTP/2.
84
+ # HTTP CONNECT proxies cannot carry these requests; use a direct connection,
85
+ # a SOCKS5 UDP relay or a `quic://` MASQUE proxy.
86
+ # @return [Wreq::Version] HTTP/3
87
+ HTTP_3 = nil
81
88
  end
82
89
 
83
90
  # Returns a string representation of the HTTP version.
@@ -121,8 +121,47 @@ class ErrorHandlingTest < Minitest::Test
121
121
  end
122
122
  end
123
123
 
124
+ def test_proxy_tcp_connect_timeout_keeps_proxy_error
125
+ skip "Requires a stalled TCP handshake from a full loopback accept queue" unless RUBY_PLATFORM.include?("linux") || Gem.win_platform?
126
+
127
+ with_stalled_tcp_listener do |port|
128
+ %w[http socks5h].each do |scheme|
129
+ client = Wreq::Client.new(proxy: "#{scheme}://127.0.0.1:#{port}", connect_timeout: 1, timeout: 5)
130
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
131
+
132
+ error = assert_raises(Wreq::ProxyConnectionError, "#{scheme} proxy TCP deadline") do
133
+ client.get("https://127.0.0.1:443/")
134
+ end
135
+ assert_instance_of Wreq::ProxyConnectionError, error
136
+ assert_operator Process.clock_gettime(Process::CLOCK_MONOTONIC) - start, :>=, 0.9,
137
+ "#{scheme} proxy should time out, not fail immediately"
138
+ end
139
+ end
140
+ end
141
+
124
142
  private
125
143
 
144
+ def with_stalled_tcp_listener
145
+ sockets = []
146
+ listener = Socket.new(:INET, :STREAM)
147
+ listener.bind(Socket.sockaddr_in(0, "127.0.0.1"))
148
+ listener.listen(0)
149
+ address = listener.local_address
150
+
151
+ # Leave the accept queue full and verify a subsequent dial stays pending.
152
+ pending = 8.times.any? do
153
+ socket = Socket.new(:INET, :STREAM)
154
+ sockets << socket
155
+ socket.connect_nonblock(address, exception: false) == :wait_writable &&
156
+ IO.select(nil, [socket], nil, 0.2).nil?
157
+ end
158
+ assert pending, "Expected a stalled TCP handshake on the loopback fixture"
159
+ yield address.ip_port
160
+ ensure
161
+ sockets.each(&:close)
162
+ listener&.close
163
+ end
164
+
126
165
  def with_hanging_server
127
166
  server = TCPServer.new("127.0.0.1", 0)
128
167
  accepted = Queue.new
@@ -227,12 +227,21 @@ class OptionValidationTest < Minitest::Test
227
227
  end
228
228
 
229
229
  def test_protocol_only_options_are_mutually_exclusive
230
- error = assert_raises(ArgumentError) do
231
- Wreq::Client.new(http1_only: true, http2_only: true)
230
+ [:http1_only, :http2_only, :http3_only].combination(2) do |first, second|
231
+ error = assert_raises(ArgumentError) do
232
+ Wreq::Client.new(**{first => true, second => true})
233
+ end
234
+
235
+ assert_includes error.message, ":#{first}"
236
+ assert_includes error.message, ":#{second}"
232
237
  end
233
238
 
234
- assert_includes error.message, ":http1_only"
235
- assert_includes error.message, ":http2_only"
239
+ assert_instance_of Wreq::Client,
240
+ Wreq::Client.new(http3_only: true, http1_only: false, http2_only: nil)
241
+ assert_instance_of Wreq::Client,
242
+ Wreq::Client.new(http1_only: true, http3_only: false)
243
+ assert_instance_of Wreq::Client,
244
+ Wreq::Client.new(http2_only: true, http3_only: nil)
236
245
  end
237
246
 
238
247
  def test_validation_reports_the_first_failed_rule
data/wreq.gemspec CHANGED
@@ -1,13 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+
3
5
  Gem::Specification.new do |spec|
4
6
  spec.name = "wreq"
5
7
  # RubyGems integrates and expects `cargo`.
6
8
  # Read more about
7
9
  # [Gem::Ext::CargoBuilder](https://github.com/rubygems/rubygems/blob/v3.5.23/lib/rubygems/ext/cargo_builder.rb)
8
10
  #
9
- # RubyGems accepts a fourth version segment, which Cargo does not.
10
- spec.version = File.read(File.join(__dir__, "VERSION")).strip
11
+ # wreq relies on "version" in `Cargo.toml` for the release process. You can read this gem spec with:
12
+ # `bundle exec ruby -e 'puts Gem::Specification.load("wreq.gemspec")'`
13
+ #
14
+ # keep in sync the key "wreq-ruby" with `Rakefile`.
15
+ #
16
+ # uses `cargo` to extract the version.
17
+ cargo_output = `cargo metadata --format-version 1`
18
+ cargo_output.force_encoding("UTF-8")
19
+ spec.version = JSON.parse(cargo_output.strip)
20
+ .fetch("packages")
21
+ .find { |p| p["name"] == "wreq-ruby" }
22
+ .fetch("version")
11
23
  spec.authors = ["SearchApi"]
12
24
  spec.email = ["support@searchapi.io"]
13
25
  spec.summary = "Ruby bindings for wreq, an HTTP client with TLS/HTTP2 browser fingerprinting"
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.2.1
4
+ version: 1.3.5
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - SearchApi
@@ -24,7 +24,6 @@ files:
24
24
  - LICENSE
25
25
  - README.md
26
26
  - Rakefile
27
- - VERSION
28
27
  - crates/wreq-util/.github/FUNDING.yml
29
28
  - crates/wreq-util/.github/ISSUE_TEMPLATE/bug_report.md
30
29
  - crates/wreq-util/.github/ISSUE_TEMPLATE/custom.md
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.3.2.1