excon 0.101.0 → 0.103.0

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: 80e84893b8e820b92e6d8a98659f5e253b2e3ef1702762b2e9a581d02293b726
4
- data.tar.gz: 1b4d8e9c815f11db2569fc7c9a7624c829564469b48b4e636d51aaeb5214df60
3
+ metadata.gz: 2c1759dde8542ab4e6147d2c51ce7e674d4fdd46b48f0aed3a77ed823917d336
4
+ data.tar.gz: 5c4c66737d283ed9d4d186cd46809c5c2fd0fc346c06564140b39a131fdfb44f
5
5
  SHA512:
6
- metadata.gz: 0a2aab3a6183402b262c8dafab16b9ab7bb953e0b506b3ba84a066f507744b2ef45bb12615f72fec03495af420d1d2b0dacbf45435e6ed60b544e642487bc569
7
- data.tar.gz: 31085df3ec377c67f8765513d96ab09ebdfa592c850af5ff75fd322ebedc5a9a602945d7b81f3af6041d1156268f3ae622e6e1c25e82a2e977b401bdbf11610b
6
+ metadata.gz: 803189e9d2dc991e48114c4f5ec7071ff04e4ea3f88d6872b3bcfe066cda38055c98b44cad83e5b9edabb677684b75c1a673c232303826a87857ba214c75cf6b
7
+ data.tar.gz: cab31317bdbc12398a33ce0b4a385584ca5c3e1cd2be2b201fb5e7ac0161b330e235d0ecd489fa304356367ab98fc868cc610d3afaf12bd3b4636ea182cda92e
data/README.md CHANGED
@@ -191,6 +191,11 @@ connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
191
191
 
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
+
195
+ # set up desired dns_timeouts for resolving addresses (default is set by Resolv)
196
+ # it accepts an integer or an array of integers for retrying with different timeouts
197
+ # see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
198
+ connection = Excon.new('http://geemus.com/', :dns_timeouts => 3)
194
199
  ```
195
200
 
196
201
  ## Chunked Requests
@@ -246,9 +246,9 @@ module Excon
246
246
 
247
247
  host_key = datum[:headers].keys.detect {|k| k.casecmp('Host') == 0 } || 'Host'
248
248
  if datum[:scheme] == UNIX
249
- datum[:headers][host_key] ||= ''
249
+ datum[:headers][host_key] ||= ''
250
250
  else
251
- datum[:headers][host_key] ||= datum[:host] + port_string(datum)
251
+ datum[:headers][host_key] ||= datum[:host] + port_string(datum)
252
252
  end
253
253
 
254
254
  # RFC 7230, section 5.4, states that the Host header SHOULD be the first one # to be present.
@@ -46,6 +46,7 @@ module Excon
46
46
  :chunk_size,
47
47
  :debug_request,
48
48
  :debug_response,
49
+ :dns_timeouts,
49
50
  :headers,
50
51
  :instrumentor, # Used for setting logging within Connection
51
52
  :logger,
@@ -134,41 +135,43 @@ module Excon
134
135
  end
135
136
  # these come last as they rely on the above
136
137
  DEFAULTS = {
137
- :chunk_size => CHUNK_SIZE || DEFAULT_CHUNK_SIZE,
138
+ :chunk_size => CHUNK_SIZE || DEFAULT_CHUNK_SIZE,
138
139
  # see https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28default.29
139
140
  # list provided then had DES related things sorted to the end
140
- :ciphers => 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:DES-CBC3-SHA:!DSS',
141
- :connect_timeout => 60,
142
- :debug_request => false,
143
- :debug_response => false,
144
- :headers => {
141
+ :ciphers => 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:DES-CBC3-SHA:!DSS',
142
+ :connect_timeout => 60,
143
+ :debug_request => false,
144
+ :debug_response => false,
145
+ :dns_timeouts => nil,
146
+ # nil allows Resolv::DNS to set its default timeouts value (see https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
147
+ :headers => {
145
148
  'User-Agent' => USER_AGENT,
146
149
  'Accept' => '*/*'
147
150
  },
148
- :idempotent => false,
149
- :instrumentor_name => 'excon',
150
- :middlewares => [
151
+ :idempotent => false,
152
+ :instrumentor_name => 'excon',
153
+ :middlewares => [
151
154
  Excon::Middleware::ResponseParser,
152
155
  Excon::Middleware::Expects,
153
156
  Excon::Middleware::Idempotent,
154
157
  Excon::Middleware::Instrumentor,
155
158
  Excon::Middleware::Mock
156
159
  ],
157
- :mock => false,
158
- :nonblock => true,
159
- :omit_default_port => false,
160
- :persistent => false,
161
- :read_timeout => 60,
162
- :retry_errors => DEFAULT_RETRY_ERRORS,
163
- :retry_limit => DEFAULT_RETRY_LIMIT,
164
- :ssl_verify_peer => true,
165
- :ssl_uri_schemes => [HTTPS],
166
- :stubs => :global,
167
- :tcp_nodelay => false,
168
- :thread_safe_sockets => true,
169
- :uri_parser => URI,
170
- :versions => VERSIONS,
171
- :write_timeout => 60
160
+ :mock => false,
161
+ :nonblock => true,
162
+ :omit_default_port => false,
163
+ :persistent => false,
164
+ :read_timeout => 60,
165
+ :retry_errors => DEFAULT_RETRY_ERRORS,
166
+ :retry_limit => DEFAULT_RETRY_LIMIT,
167
+ :ssl_verify_peer => true,
168
+ :ssl_uri_schemes => [HTTPS],
169
+ :stubs => :global,
170
+ :tcp_nodelay => false,
171
+ :thread_safe_sockets => true,
172
+ :uri_parser => URI,
173
+ :versions => VERSIONS,
174
+ :write_timeout => 60
172
175
  }
173
176
 
174
177
  end
data/lib/excon/socket.rb CHANGED
@@ -121,7 +121,10 @@ module Excon
121
121
  family = @data[:proxy][:family]
122
122
  end
123
123
 
124
- Resolv.each_address(hostname) do |ip|
124
+ dns_resolver = Resolv::DNS.new
125
+ dns_resolver.timeouts = @data[:dns_timeouts]
126
+ resolver = Resolv.new([Resolv::Hosts.new, dns_resolver])
127
+ resolver.each_address(hostname) do |ip|
125
128
  # already succeeded on previous addrinfo
126
129
  if @socket
127
130
  break
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.101.0'
4
+ VERSION = '0.103.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.101.0
4
+ version: 0.103.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-08-23 00:00:00.000000000 Z
13
+ date: 2023-09-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec