excon 0.103.0 → 0.104.0

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: 2c1759dde8542ab4e6147d2c51ce7e674d4fdd46b48f0aed3a77ed823917d336
4
- data.tar.gz: 5c4c66737d283ed9d4d186cd46809c5c2fd0fc346c06564140b39a131fdfb44f
3
+ metadata.gz: d5178f794971246bbfa44097a97594cb9480a13ff11b9884c1fa1ac79e94c0a6
4
+ data.tar.gz: c5ea1c85e77eddba09b655f18ad415f03eb824481e562ee88c0c756850c61463
5
5
  SHA512:
6
- metadata.gz: 803189e9d2dc991e48114c4f5ec7071ff04e4ea3f88d6872b3bcfe066cda38055c98b44cad83e5b9edabb677684b75c1a673c232303826a87857ba214c75cf6b
7
- data.tar.gz: cab31317bdbc12398a33ce0b4a385584ca5c3e1cd2be2b201fb5e7ac0161b330e235d0ecd489fa304356367ab98fc868cc610d3afaf12bd3b4636ea182cda92e
6
+ metadata.gz: 210b6c6ca9be3b3668f9f24c509f95e6a41533c9f0290ccd4a967f92fed1f335f837ce8ff52b8bcc3d5fb3d21d236ed179a67d70df2c8c0202a3772a282c5840
7
+ data.tar.gz: a1cf5fdb74468a879741b482bef3734e74b4c390551cbfbad7762b06bb892877a30255d872c27404ee0e0f137ad208c7fa73b167fb64fdddaffe063e8a3eb5bb
data/README.md CHANGED
@@ -192,10 +192,20 @@ connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
192
192
  # opt-out of nonblocking operations for performance and/or as a workaround
193
193
  connection = Excon.new('http://geemus.com/', :nonblock => false)
194
194
 
195
+ # DEPRECATED in favour of `resolv_resolver` (see below)
195
196
  # set up desired dns_timeouts for resolving addresses (default is set by Resolv)
196
197
  # it accepts an integer or an array of integers for retrying with different timeouts
197
198
  # see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
198
199
  connection = Excon.new('http://geemus.com/', :dns_timeouts => 3)
200
+
201
+ # set a custom resolver for Resolv
202
+ # you can use custom nameservers and timeouts
203
+ # `timeouts` accepts an integer or an array of integers for retrying with different timeouts
204
+ # see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
205
+ dns_resolver = Resolv::DNS.new(nameserver: ['127.0.0.1'])
206
+ dns_resolver.timeouts = 3
207
+ resolver = Resolv.new([Resolv::Hosts.new, dns_resolver])
208
+ connection = Excon.new('http://geemus.com', :resolv_resolver => resolver)
199
209
  ```
200
210
 
201
211
  ## Chunked Requests
@@ -59,6 +59,7 @@ module Excon
59
59
  :query,
60
60
  :read_timeout,
61
61
  :request_block,
62
+ :resolv_resolver,
62
63
  :response_block,
63
64
  :stubs,
64
65
  :user,
@@ -162,6 +163,7 @@ module Excon
162
163
  :omit_default_port => false,
163
164
  :persistent => false,
164
165
  :read_timeout => 60,
166
+ :resolv_resolver => nil,
165
167
  :retry_errors => DEFAULT_RETRY_ERRORS,
166
168
  :retry_limit => DEFAULT_RETRY_LIMIT,
167
169
  :ssl_verify_peer => true,
data/lib/excon/socket.rb CHANGED
@@ -121,9 +121,16 @@ module Excon
121
121
  family = @data[:proxy][:family]
122
122
  end
123
123
 
124
- dns_resolver = Resolv::DNS.new
125
- dns_resolver.timeouts = @data[:dns_timeouts]
126
- resolver = Resolv.new([Resolv::Hosts.new, dns_resolver])
124
+ resolver = @data[:resolv_resolver] || Resolv.new
125
+
126
+ # Deprecated
127
+ if @data[:dns_timeouts]
128
+ Excon.display_warning('dns_timeouts is deprecated, use resolv_resolver instead.')
129
+ dns_resolver = Resolv::DNS.new
130
+ dns_resolver.timeouts = @data[:dns_timeouts]
131
+ resolver = Resolv.new([Resolv::Hosts.new, dns_resolver])
132
+ end
133
+
127
134
  resolver.each_address(hostname) do |ip|
128
135
  # already succeeded on previous addrinfo
129
136
  if @socket
data/lib/excon/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Excon
4
- VERSION = '0.103.0'
4
+ VERSION = '0.104.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.103.0
4
+ version: 0.104.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-09-13 00:00:00.000000000 Z
13
+ date: 2023-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec