httpx 0.24.2 → 0.24.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63f31bb23a4d1676f6d537df456a52e4ee5c4f24e39239072d698abf37cf48fd
4
- data.tar.gz: b21ec1aeac1a3fdb52be5cccc3e9781bbc8f5e63f81c04a08eb60b89dba00c1b
3
+ metadata.gz: 145a6e293b5ae6bfc1008765a755ab823d490edf7c50bdbf1de01194e3e1537b
4
+ data.tar.gz: 42d235a66fdb050a993b305d3aefed91893d26253cc62864ff2d0d088167ef0a
5
5
  SHA512:
6
- metadata.gz: f0554a088f8ee971e2ccb6534f4d6ef2e43c95c04e6b3930dbeded34485664f340e8c1109a10608c4706098ad43726f2547905eea641b5a45d148ae1f7829e55
7
- data.tar.gz: 92800524ec31ec676ba7e90a0f51a7d0ea8f6e752253c2b31c0805b807fc2f5fcdbb491f74ceb674e72dd691980cca968a945ec81bd2f9f7ff6eb25b5f9e0a2a
6
+ metadata.gz: 7b10d4d91debc907d3445526ab864357a1e39cddfbe8b628f104241ed9015ae340e122dd49535be21bda7b20b95ebc047db4c476b7ff412e310d685f835e62c3
7
+ data.tar.gz: 3d82a8bc8bc3d5e6f94c2dde6f330ab52a3a42e0cd95e4b62328e4b6b005aac9946d1903d384f0944112e997ca26801dc342d77b44290dddb8e88ec0523e1338
@@ -0,0 +1,12 @@
1
+ # 0.24.3
2
+
3
+ ## Improvements
4
+
5
+ * faraday adapter: reraise httpx timeout errors as faraday errors.
6
+ * faraday adapter: support `:bind` option, which expects a host and port to connect to.
7
+
8
+ ## Bugfixes
9
+
10
+ * faraday adapter: fix `#close` implementation using the wrong ivar.
11
+ * faraday adapter: fix usage of `requestt_timeout` translation of faraday timeouts into httpx timeouts.
12
+ * faraday adapter: `ssl: { verify: false }` was being ignored, and certification verification was still proceeding.
@@ -40,7 +40,13 @@ module Faraday
40
40
 
41
41
  @connection = ::HTTPX.plugin(:compression).plugin(:persistent).plugin(ReasonPlugin)
42
42
  @connection = @connection.with(@connection_options) unless @connection_options.empty?
43
- @connection = @connection.with(options_from_env(env))
43
+ connection_opts = options_from_env(env)
44
+
45
+ if (bind = env.request.bind)
46
+ @bind = TCPSocket.new(bind[:host], bind[:port])
47
+ connection_opts[:io] = @bind
48
+ end
49
+ @connection = @connection.with(connection_opts)
44
50
 
45
51
  if (proxy = env.request.proxy)
46
52
  proxy_options = { uri: proxy.uri }
@@ -55,7 +61,8 @@ module Faraday
55
61
  end
56
62
 
57
63
  def close
58
- @session.close
64
+ @connection.close if @connection
65
+ @bind.close if @bind
59
66
  end
60
67
 
61
68
  private
@@ -73,6 +80,8 @@ module Faraday
73
80
  Errno::EPIPE,
74
81
  ::HTTPX::ConnectionError => e
75
82
  raise CONNECTION_FAILED_ERROR, e
83
+ rescue ::HTTPX::TimeoutError => e
84
+ raise Faraday::TimeoutError, e
76
85
  end
77
86
 
78
87
  def build_request(env)
@@ -87,21 +96,25 @@ module Faraday
87
96
 
88
97
  def options_from_env(env)
89
98
  timeout_options = {}
90
- if (sec = request_timeout(:read, env))
99
+ req_opts = env.request
100
+ if (sec = request_timeout(:read, req_opts))
91
101
  timeout_options[:operation_timeout] = sec
92
102
  end
93
103
 
94
- if (sec = request_timeout(:write, env))
104
+ if (sec = request_timeout(:write, req_opts))
95
105
  timeout_options[:operation_timeout] = sec
96
106
  end
97
107
 
98
- if (sec = request_timeout(:open, env))
108
+ if (sec = request_timeout(:open, req_opts))
99
109
  timeout_options[:connect_timeout] = sec
100
110
  end
101
111
 
102
112
  ssl_options = {}
103
113
 
104
- ssl_options[:verify_mode] = OpenSSL::SSL::VERIFY_PEER if env.ssl.verify
114
+ unless env.ssl.verify.nil?
115
+ ssl_options[:verify_mode] = env.ssl.verify ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
116
+ end
117
+
105
118
  ssl_options[:ca_file] = env.ssl.ca_file if env.ssl.ca_file
106
119
  ssl_options[:ca_path] = env.ssl.ca_path if env.ssl.ca_path
107
120
  ssl_options[:cert_store] = env.ssl.cert_store if env.ssl.cert_store
@@ -232,6 +245,8 @@ module Faraday
232
245
  handler.on_complete.call(handler.env)
233
246
  end
234
247
  end
248
+ rescue ::HTTPX::TimeoutError => e
249
+ raise Faraday::TimeoutError, e
235
250
  end
236
251
 
237
252
  # from Faraday::Adapter#connection
@@ -299,6 +314,8 @@ module Faraday
299
314
  response.raise_for_status unless response.is_a?(::HTTPX::Response)
300
315
  response
301
316
  end
317
+ rescue ::HTTPX::TimeoutError => e
318
+ raise Faraday::TimeoutError, e
302
319
  end
303
320
 
304
321
  def parallel?(env)
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.24.2"
4
+ VERSION = "0.24.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.2
4
+ version: 0.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-30 00:00:00.000000000 Z
11
+ date: 2023-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -102,6 +102,7 @@ extra_rdoc_files:
102
102
  - doc/release_notes/0_24_0.md
103
103
  - doc/release_notes/0_24_1.md
104
104
  - doc/release_notes/0_24_2.md
105
+ - doc/release_notes/0_24_3.md
105
106
  - doc/release_notes/0_2_0.md
106
107
  - doc/release_notes/0_2_1.md
107
108
  - doc/release_notes/0_3_0.md
@@ -196,6 +197,7 @@ files:
196
197
  - doc/release_notes/0_24_0.md
197
198
  - doc/release_notes/0_24_1.md
198
199
  - doc/release_notes/0_24_2.md
200
+ - doc/release_notes/0_24_3.md
199
201
  - doc/release_notes/0_2_0.md
200
202
  - doc/release_notes/0_2_1.md
201
203
  - doc/release_notes/0_3_0.md