excon 0.44.4 → 0.45.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of excon might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03ddb771305f4a3c7b4300c1a335ee9393d94604
4
- data.tar.gz: 1321c392222a025b61751ed39a9c0681e739e01f
3
+ metadata.gz: 3672a722de0403e6e2826a2db98fe28b97ba73f5
4
+ data.tar.gz: ef99f47f4735d41422cf58e2dc29f1d81186164a
5
5
  SHA512:
6
- metadata.gz: b56c56888dd2b535a4c5746c37f132a8b4379a3a49b84e74db5f314828e4a231b38ab5881eab7568a2600bc8866d597969cdafe422c334468a3fbd606b9785f9
7
- data.tar.gz: 1937daeb7f9206ad8b63514864e1424c02fa840e3be76d329eb02107d032c33dbdbdf85b16e3b58406c1aba5c7366ca28c9dbb75fed4b3040e5cf476470d8d01
6
+ metadata.gz: 7275582af99e3738d3bb43d54f639092772fd13878fcfcc1ab2403fe8df81d16616b3b8d89a51ea6e80153814604dc42fa79cf7571c95a4d2c5cdcd414d61534
7
+ data.tar.gz: b24381617571f4ae8a8369f01c7e0c1679a5be7eefb1604a122924636706cf540cb6fdc70a0bbb59ca208339ff762629108232a5dc3819030c5eed2834717cbc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- excon (0.44.4)
4
+ excon (0.45.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -308,7 +308,7 @@ connection = Excon.new(
308
308
  )
309
309
  ```
310
310
 
311
- Excon will then instrument each request, retry, and error. The corresponding events are named excon.request, excon.retry, and excon.error respectively.
311
+ Excon will then instrument each request, retry, and error. The corresponding events are named `excon.request`, `excon.retry`, and `excon.error` respectively.
312
312
 
313
313
  ```ruby
314
314
  ActiveSupport::Notifications.subscribe(/excon/) do |*args|
@@ -316,7 +316,7 @@ ActiveSupport::Notifications.subscribe(/excon/) do |*args|
316
316
  end
317
317
  ```
318
318
 
319
- If you prefer to label each event with something other than "excon," you may specify
319
+ If you prefer to label each event with a namespace other than "excon", you may specify
320
320
  an alternate name in the constructor:
321
321
 
322
322
  ```ruby
@@ -327,7 +327,23 @@ connection = Excon.new(
327
327
  )
328
328
  ```
329
329
 
330
- If you don't want to add activesupport to your application, simply define a class which implements the same #instrument method like so:
330
+ Note: Excon's ActiveSupport::Notifications implementation has the following event format: `<namespace>.<event>` which is the opposite of the Rails' implementation.
331
+
332
+ ActiveSupport provides a [subscriber](http://api.rubyonrails.org/classes/ActiveSupport/Subscriber.html) interface which lets you attach a subscriber to a namespace. Due to the incompability above, you won't be able to attach a subscriber to the "excon" namespace out of the box.
333
+
334
+ If you want this functionality, you can use a simple adapter such as this one:
335
+
336
+ ```ruby
337
+ class ExconToRailsInstrumentor
338
+ def self.instrument(name, datum, &block)
339
+ namespace, *event = name.split(".")
340
+ rails_name = [event, namespace].flatten.join(".")
341
+ ActiveSupport::Notifications.instrument(rails_name, datum, &block)
342
+ end
343
+ end
344
+ ```
345
+
346
+ If you don't want to add ActiveSupport to your application, simply define a class which implements the same `#instrument` method like so:
331
347
 
332
348
  ```ruby
333
349
  class SimpleInstrumentor
@@ -344,7 +360,7 @@ end
344
360
 
345
361
  The #instrument method will be called for each HTTP request, response, retry, and error.
346
362
 
347
- For debugging purposes you can also use Excon::StandardInstrumentor to output all events to stderr. This can also be specified by setting the `EXCON_DEBUG` ENV var.
363
+ For debugging purposes you can also use `Excon::StandardInstrumentor` to output all events to stderr. This can also be specified by setting the `EXCON_DEBUG` ENV var.
348
364
 
349
365
  See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's [instrumentation_test.rb](https://github.com/excon/excon/blob/master/tests/middlewares/instrumentation_tests.rb) for more examples of instrumenting excon.
350
366
 
@@ -1,3 +1,12 @@
1
+ 0.45.0 03/26/2015
2
+ =================
3
+
4
+ prefer default SSL config to ENV, when available
5
+ document instrumentor deviation from rails format
6
+ better error/warning around openssl 1.0.2 bug
7
+ fix nonblocking ssl connect to not have tight loop
8
+ also remove user/pass when following redirects
9
+
1
10
  0.44.4 03/04/2015
2
11
  =================
3
12
 
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'excon'
16
- s.version = '0.44.4'
17
- s.date = '2015-03-04'
16
+ s.version = '0.45.0'
17
+ s.date = '2015-03-26'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
 
3
- VERSION = '0.44.4'
3
+ VERSION = '0.45.0'
4
4
 
5
5
  CR_NL = "\r\n"
6
6
 
@@ -15,8 +15,11 @@ module Excon
15
15
  response = datum.delete(:response)
16
16
 
17
17
  params = datum.dup
18
- params.delete(:stack)
19
18
  params.delete(:connection)
19
+ params.delete(:password)
20
+ params.delete(:stack)
21
+ params.delete(:user)
22
+
20
23
  if [301, 302, 303].include?(response[:status])
21
24
  params[:method] = :get
22
25
  params.delete(:body)
@@ -241,6 +241,14 @@ module Excon
241
241
  # I wish that this API accepted a start position, then we wouldn't
242
242
  # have to slice data when there is a short write.
243
243
  written = @socket.write_nonblock(data)
244
+ rescue Errno::EFAULT
245
+ if OpenSSL::OPENSSL_LIBRARY_VERSION.split(' ')[1] == '1.0.2'
246
+ msg = "The version of OpenSSL this ruby is built against (1.0.2) has a vulnerability
247
+ which causes a fault. For more, see https://github.com/excon/excon/issues/467"
248
+ raise SecurityError.new(msg)
249
+ else
250
+ raise error
251
+ end
244
252
  rescue OpenSSL::SSL::SSLError, Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitWritable => error
245
253
  if error.is_a?(OpenSSL::SSL::SSLError) && error.message != 'write would block'
246
254
  raise error
@@ -30,10 +30,10 @@ module Excon
30
30
  # turn verification on
31
31
  ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
32
32
 
33
- if ca_file = ENV['SSL_CERT_FILE'] || @data[:ssl_ca_file]
33
+ if ca_file = @data[:ssl_ca_file] || ENV['SSL_CERT_FILE']
34
34
  ssl_context.ca_file = ca_file
35
35
  end
36
- if ca_path = ENV['SSL_CERT_DIR'] || @data[:ssl_ca_path]
36
+ if ca_path = @data[:ssl_ca_path] || ENV['SSL_CERT_DIR']
37
37
  ssl_context.ca_path = ca_path
38
38
  end
39
39
  if cert_store = @data[:ssl_cert_store]
@@ -116,20 +116,17 @@ module Excon
116
116
 
117
117
  begin
118
118
  if @nonblock
119
- loop do
120
- begin
121
- @socket.connect_nonblock
122
- break # connect succeeded
123
- rescue OpenSSL::SSL::SSLError => error
124
- # would block, rescue and retry as select is non-helpful
125
- raise error unless error.message == 'read would block'
126
- end
119
+ begin
120
+ @socket.connect_nonblock
121
+ rescue IO::WaitReadable
122
+ IO.select([@socket])
123
+ retry
127
124
  end
128
125
  else
129
126
  @socket.connect
130
127
  end
131
- rescue OpenSSL::SSL::SSLError => e
132
- raise e
128
+ rescue OpenSSL::SSL::SSLError
129
+ raise
133
130
  rescue
134
131
  raise Excon::Errors::Timeout.new('connect timeout reached')
135
132
  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.44.4
4
+ version: 0.45.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: 2015-03-04 00:00:00.000000000 Z
13
+ date: 2015-03-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport