excon 0.98.0 → 0.99.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: b980a243ce1d748881c7d985f42db2e6fc20b382597220d2c5d5541e8b3359f9
4
- data.tar.gz: 2dacdc182c779be0cf4c978092baca5fef6e4fa0971369be2764b7e090830f68
3
+ metadata.gz: 4de69b0df9a1fc68f382e6d007845ddd9dac6ec8e6f0150b0988caafc604fc66
4
+ data.tar.gz: 3735d61f7219a99bfcfd8f953c7dd16f66b0232a794c602042f30a7eda7c9334
5
5
  SHA512:
6
- metadata.gz: 9495b2cf646c81eb2ab6691cbafe44ddc4842cba32abd2c849b348ad13ad0d067f8ef14babeed0cee3116bf7d7939ec68fdc5c7632455104183ea7d1dcefb938
7
- data.tar.gz: bdc12e6fc203c223bad18faaa42311ed416befffe2475c74e2d164fca3a44389b55627b3178022a38b6440a54fadba1ec63b8eb42af843f28fdb731713035725
6
+ metadata.gz: 366bb5af60bbd24b607bb9306a5f1581e0daeb95881e33376e85a9a7892935758fb06c09d656f27ffd3f791fbcc372e9703bf738f08a10c5d46f06558a34e19e
7
+ data.tar.gz: a38b16b4e9fe30c66d75e96e39330f6661a3c4a906801e7eaade9c3efd4af8d86a804b224d264f777f8d13026c0c1dc18581120ce179c5bfd6cf8ae3e427cd10
@@ -62,6 +62,7 @@ module Excon
62
62
  # @option params [Class] :instrumentor Responds to #instrument as in ActiveSupport::Notifications
63
63
  # @option params [String] :instrumentor_name Name prefix for #instrument events. Defaults to 'excon'
64
64
  def initialize(params = {})
65
+ @pid = Process.pid
65
66
  @data = Excon.defaults.dup
66
67
  # merge does not deep-dup, so make sure headers is not the original
67
68
  @data[:headers] = @data[:headers].dup
@@ -480,6 +481,11 @@ module Excon
480
481
  @_excon_sockets ||= {}
481
482
  @_excon_sockets.compare_by_identity
482
483
 
484
+ if @pid != Process.pid
485
+ @_excon_sockets.clear # GC will take care of closing sockets
486
+ @pid = Process.pid
487
+ end
488
+
483
489
  if @data[:thread_safe_sockets]
484
490
  # In a multi-threaded world, if the same connection is used by multiple
485
491
  # threads at the same time to connect to the same destination, they may
data/lib/excon/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Excon
3
- VERSION = '0.98.0'
3
+ VERSION = '0.99.0'
4
4
  end
data/lib/excon.rb CHANGED
@@ -198,8 +198,13 @@ module Excon
198
198
  headers_match = !stub.has_key?(:headers) || stub[:headers].keys.all? do |key|
199
199
  case value = stub[:headers][key]
200
200
  when Regexp
201
- if (match = value.match(request_params[:headers][key]))
202
- captures[:headers][key] = match.captures
201
+ case request_params[:headers][key]
202
+ when String
203
+ if (match = value.match(request_params[:headers][key]))
204
+ captures[:headers][key] = match.captures
205
+ end
206
+ when Regexp # for unstub on regex params
207
+ match = (value == request_params[:headers][key])
203
208
  end
204
209
  match
205
210
  else
@@ -209,8 +214,13 @@ module Excon
209
214
  non_headers_match = (stub.keys - [:headers]).all? do |key|
210
215
  case value = stub[key]
211
216
  when Regexp
212
- if (match = value.match(request_params[key]))
213
- captures[key] = match.captures
217
+ case request_params[key]
218
+ when String
219
+ if (match = value.match(request_params[key]))
220
+ captures[key] = match.captures
221
+ end
222
+ when Regexp # for unstub on regex params
223
+ match = (value == request_params[key])
214
224
  end
215
225
  match
216
226
  else
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.98.0
4
+ version: 0.99.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-01-27 00:00:00.000000000 Z
13
+ date: 2023-02-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec