excon 0.49.0 → 0.88.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CONTRIBUTORS.md +33 -3
- data/LICENSE.md +1 -1
- data/README.md +77 -7
- data/data/cacert.pem +1279 -1940
- data/excon.gemspec +32 -170
- data/lib/excon/connection.rb +257 -154
- data/lib/excon/constants.rb +44 -16
- data/lib/excon/error.rb +229 -0
- data/lib/excon/extensions/uri.rb +1 -0
- data/lib/excon/headers.rb +5 -3
- data/lib/excon/instrumentors/logging_instrumentor.rb +48 -0
- data/lib/excon/instrumentors/standard_instrumentor.rb +21 -0
- data/lib/excon/middlewares/base.rb +7 -0
- data/lib/excon/middlewares/capture_cookies.rb +2 -1
- data/lib/excon/middlewares/decompress.rb +3 -2
- data/lib/excon/middlewares/escape_path.rb +1 -0
- data/lib/excon/middlewares/expects.rb +8 -1
- data/lib/excon/middlewares/idempotent.rb +27 -3
- data/lib/excon/middlewares/instrumentor.rb +9 -0
- data/lib/excon/middlewares/mock.rb +14 -4
- data/lib/excon/middlewares/redirect_follower.rb +28 -4
- data/lib/excon/middlewares/response_parser.rb +4 -0
- data/lib/excon/pretty_printer.rb +2 -8
- data/lib/excon/response.rb +16 -12
- data/lib/excon/socket.rb +56 -36
- data/lib/excon/ssl_socket.rb +70 -25
- data/lib/excon/test/plugin/server/exec.rb +26 -0
- data/lib/excon/test/plugin/server/puma.rb +23 -0
- data/lib/excon/test/plugin/server/unicorn.rb +38 -0
- data/lib/excon/test/plugin/server/webrick.rb +26 -0
- data/lib/excon/test/server.rb +106 -0
- data/lib/excon/unix_socket.rb +2 -0
- data/lib/excon/utils.rb +65 -10
- data/lib/excon/version.rb +4 -0
- data/lib/excon.rb +35 -20
- metadata +69 -87
- data/Gemfile +0 -19
- data/Gemfile.lock +0 -285
- data/Rakefile +0 -144
- data/benchmarks/class_vs_lambda.rb +0 -50
- data/benchmarks/concat_vs_insert.rb +0 -21
- data/benchmarks/concat_vs_interpolate.rb +0 -21
- data/benchmarks/cr_lf.rb +0 -21
- data/benchmarks/downcase-eq-eq_vs_casecmp.rb +0 -169
- data/benchmarks/excon.rb +0 -69
- data/benchmarks/excon_vs.rb +0 -165
- data/benchmarks/for_vs_array_each.rb +0 -27
- data/benchmarks/for_vs_hash_each.rb +0 -27
- data/benchmarks/has_key-vs-lookup.rb +0 -177
- data/benchmarks/headers_case_sensitivity.rb +0 -83
- data/benchmarks/headers_split_vs_match.rb +0 -34
- data/benchmarks/implicit_block-vs-explicit_block.rb +0 -98
- data/benchmarks/merging.rb +0 -21
- data/benchmarks/single_vs_double_quotes.rb +0 -21
- data/benchmarks/string_ranged_index.rb +0 -87
- data/benchmarks/strip_newline.rb +0 -115
- data/benchmarks/vs_stdlib.rb +0 -82
- data/changelog.txt +0 -959
- data/lib/excon/errors.rb +0 -172
- data/lib/excon/standard_instrumentor.rb +0 -27
- data/tests/authorization_header_tests.rb +0 -33
- data/tests/bad_tests.rb +0 -47
- data/tests/basic_tests.rb +0 -334
- data/tests/complete_responses.rb +0 -31
- data/tests/data/127.0.0.1.cert.crt +0 -14
- data/tests/data/127.0.0.1.cert.key +0 -15
- data/tests/data/excon.cert.crt +0 -14
- data/tests/data/excon.cert.key +0 -15
- data/tests/data/xs +0 -1
- data/tests/errors_tests.rb +0 -58
- data/tests/header_tests.rb +0 -119
- data/tests/middlewares/canned_response_tests.rb +0 -34
- data/tests/middlewares/capture_cookies_tests.rb +0 -34
- data/tests/middlewares/decompress_tests.rb +0 -157
- data/tests/middlewares/escape_path_tests.rb +0 -36
- data/tests/middlewares/idempotent_tests.rb +0 -131
- data/tests/middlewares/instrumentation_tests.rb +0 -312
- data/tests/middlewares/mock_tests.rb +0 -293
- data/tests/middlewares/redirect_follower_tests.rb +0 -80
- data/tests/pipeline_tests.rb +0 -40
- data/tests/proxy_tests.rb +0 -306
- data/tests/query_string_tests.rb +0 -87
- data/tests/rackups/basic.rb +0 -41
- data/tests/rackups/basic.ru +0 -3
- data/tests/rackups/basic_auth.ru +0 -14
- data/tests/rackups/deflater.ru +0 -4
- data/tests/rackups/proxy.ru +0 -18
- data/tests/rackups/query_string.ru +0 -13
- data/tests/rackups/redirecting.ru +0 -23
- data/tests/rackups/redirecting_with_cookie.ru +0 -40
- data/tests/rackups/request_headers.ru +0 -15
- data/tests/rackups/request_methods.ru +0 -21
- data/tests/rackups/response_header.ru +0 -18
- data/tests/rackups/ssl.ru +0 -16
- data/tests/rackups/ssl_mismatched_cn.ru +0 -15
- data/tests/rackups/ssl_verify_peer.ru +0 -16
- data/tests/rackups/streaming.ru +0 -30
- data/tests/rackups/thread_safety.ru +0 -17
- data/tests/rackups/timeout.ru +0 -14
- data/tests/rackups/webrick_patch.rb +0 -34
- data/tests/request_headers_tests.rb +0 -21
- data/tests/request_method_tests.rb +0 -47
- data/tests/request_tests.rb +0 -59
- data/tests/response_tests.rb +0 -197
- data/tests/servers/bad.rb +0 -20
- data/tests/servers/eof.rb +0 -17
- data/tests/servers/error.rb +0 -20
- data/tests/servers/good.rb +0 -350
- data/tests/test_helper.rb +0 -306
- data/tests/thread_safety_tests.rb +0 -39
- data/tests/timeout_tests.rb +0 -12
- data/tests/utils_tests.rb +0 -81
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'open4'
|
2
|
+
require 'excon'
|
3
|
+
require 'excon/test/plugin/server/webrick'
|
4
|
+
require 'excon/test/plugin/server/unicorn'
|
5
|
+
require 'excon/test/plugin/server/puma'
|
6
|
+
require 'excon/test/plugin/server/exec'
|
7
|
+
|
8
|
+
|
9
|
+
module Excon
|
10
|
+
module Test
|
11
|
+
class Server
|
12
|
+
attr_accessor :app, :server, :bind, :pid, :read, :write, :error, :started_at, :timeout
|
13
|
+
|
14
|
+
# Methods that must be implemented by a plugin
|
15
|
+
INSTANCE_REQUIRES = [:start]
|
16
|
+
Excon.defaults.merge!(
|
17
|
+
connect_timeout: 5,
|
18
|
+
read_timeout: 5,
|
19
|
+
write_timeout: 5
|
20
|
+
)
|
21
|
+
|
22
|
+
def initialize(args)
|
23
|
+
# TODO: Validate these args
|
24
|
+
@server = args.keys.first
|
25
|
+
@app = args[server]
|
26
|
+
args[:bind] ||= 'tcp://127.0.0.1:9292'
|
27
|
+
@bind = URI.parse(args[:bind])
|
28
|
+
@is_unix_socket = (@bind.scheme == 'unix')
|
29
|
+
@bind.host = @bind.host.gsub(/[\[\]]/, '') unless @is_unix_socket
|
30
|
+
if args[:timeout]
|
31
|
+
@timeout = args[:timeout]
|
32
|
+
else
|
33
|
+
@timeout = 20
|
34
|
+
end
|
35
|
+
name = @server.to_s.split('_').collect(&:capitalize).join
|
36
|
+
plug = nested_const_get("Excon::Test::Plugin::Server::#{name}")
|
37
|
+
self.extend plug
|
38
|
+
check_implementation(plug)
|
39
|
+
end
|
40
|
+
|
41
|
+
def open_process(*args)
|
42
|
+
if RUBY_PLATFORM == 'java'
|
43
|
+
@pid, @write, @read, @error = IO.popen4(*args)
|
44
|
+
else
|
45
|
+
GC.disable if RUBY_VERSION < '1.9'
|
46
|
+
@pid, @write, @read, @error = Open4.popen4(*args)
|
47
|
+
end
|
48
|
+
@started_at = Time.now
|
49
|
+
end
|
50
|
+
|
51
|
+
def elapsed_time
|
52
|
+
Time.now - started_at
|
53
|
+
end
|
54
|
+
|
55
|
+
def stop
|
56
|
+
if RUBY_PLATFORM == 'java'
|
57
|
+
Process.kill('USR1', pid)
|
58
|
+
else
|
59
|
+
Process.kill(9, pid)
|
60
|
+
GC.enable if RUBY_VERSION < '1.9'
|
61
|
+
Process.wait(pid)
|
62
|
+
end
|
63
|
+
|
64
|
+
if @is_unix_socket
|
65
|
+
socket = @bind.path
|
66
|
+
File.delete(socket) if File.exist?(socket)
|
67
|
+
end
|
68
|
+
|
69
|
+
# TODO: Ensure process is really dead
|
70
|
+
dump_errors
|
71
|
+
true
|
72
|
+
end
|
73
|
+
def dump_errors
|
74
|
+
lines = error.read.split($/)
|
75
|
+
while (line = lines.shift)
|
76
|
+
case line
|
77
|
+
when /(ERROR|Error)/
|
78
|
+
unless line =~ /(null cert chain|did not return a certificate|SSL_read:: internal error)/
|
79
|
+
in_err = true
|
80
|
+
puts
|
81
|
+
end
|
82
|
+
when /^(127|localhost)/
|
83
|
+
in_err = false
|
84
|
+
end
|
85
|
+
puts line if in_err
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def nested_const_get(namespace)
|
92
|
+
namespace.split('::').inject(Object) do |mod, klass|
|
93
|
+
mod.const_get(klass)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def check_implementation(plug)
|
98
|
+
INSTANCE_REQUIRES.each do |m|
|
99
|
+
unless self.respond_to? m
|
100
|
+
raise "FATAL: #{plug} does not implement ##{m}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
data/lib/excon/unix_socket.rb
CHANGED
data/lib/excon/utils.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Excon
|
2
3
|
module Utils
|
3
4
|
extend self
|
@@ -9,31 +10,67 @@ module Excon
|
|
9
10
|
UNESCAPED = /([#{ Regexp.escape(CONTROL + ' ' + DELIMS + UNWISE + NONASCII) }])/
|
10
11
|
ESCAPED = /%([0-9a-fA-F]{2})/
|
11
12
|
|
13
|
+
def binary_encode(string)
|
14
|
+
if FORCE_ENC && string.encoding != Encoding::ASCII_8BIT
|
15
|
+
if string.frozen?
|
16
|
+
string.dup.force_encoding('BINARY')
|
17
|
+
else
|
18
|
+
string.force_encoding('BINARY')
|
19
|
+
end
|
20
|
+
else
|
21
|
+
string
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
12
25
|
def connection_uri(datum = @data)
|
13
26
|
unless datum
|
14
27
|
raise ArgumentError, '`datum` must be given unless called on a Connection'
|
15
28
|
end
|
16
29
|
if datum[:scheme] == UNIX
|
17
|
-
|
30
|
+
"#{datum[:scheme]}://#{datum[:socket]}"
|
18
31
|
else
|
19
|
-
|
32
|
+
"#{datum[:scheme]}://#{datum[:host]}#{port_string(datum)}"
|
20
33
|
end
|
21
34
|
end
|
22
35
|
|
36
|
+
# Redact sensitive info from provided data
|
37
|
+
def redact(datum)
|
38
|
+
datum = datum.dup
|
39
|
+
if datum.has_key?(:headers)
|
40
|
+
if datum[:headers].has_key?('Authorization') || datum[:headers].has_key?('Proxy-Authorization')
|
41
|
+
datum[:headers] = datum[:headers].dup
|
42
|
+
end
|
43
|
+
if datum[:headers].has_key?('Authorization')
|
44
|
+
datum[:headers]['Authorization'] = REDACTED
|
45
|
+
end
|
46
|
+
if datum[:headers].has_key?('Proxy-Authorization')
|
47
|
+
datum[:headers]['Proxy-Authorization'] = REDACTED
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if datum.has_key?(:password)
|
51
|
+
datum[:password] = REDACTED
|
52
|
+
end
|
53
|
+
if datum.has_key?(:proxy) && datum[:proxy] && datum[:proxy].has_key?(:password)
|
54
|
+
datum[:proxy] = datum[:proxy].dup
|
55
|
+
datum[:proxy][:password] = REDACTED
|
56
|
+
end
|
57
|
+
datum
|
58
|
+
end
|
59
|
+
|
23
60
|
def request_uri(datum)
|
24
|
-
connection_uri(datum)
|
61
|
+
connection_uri(datum) + datum[:path] + query_string(datum)
|
25
62
|
end
|
26
63
|
|
27
64
|
def port_string(datum)
|
28
65
|
if datum[:port].nil? || (datum[:omit_default_port] && ((datum[:scheme].casecmp('http') == 0 && datum[:port] == 80) || (datum[:scheme].casecmp('https') == 0 && datum[:port] == 443)))
|
29
66
|
''
|
30
67
|
else
|
31
|
-
':'
|
68
|
+
':' + datum[:port].to_s
|
32
69
|
end
|
33
70
|
end
|
34
71
|
|
35
72
|
def query_string(datum)
|
36
|
-
str =
|
73
|
+
str = String.new
|
37
74
|
case datum[:query]
|
38
75
|
when String
|
39
76
|
str << '?' << datum[:query]
|
@@ -58,31 +95,49 @@ module Excon
|
|
58
95
|
def split_header_value(str)
|
59
96
|
return [] if str.nil?
|
60
97
|
str = str.dup.strip
|
61
|
-
str
|
62
|
-
str.scan(%r'\G((?:"(?:\\.|[^"])+?"|[^",]
|
98
|
+
str = binary_encode(str)
|
99
|
+
str.scan(%r'\G((?:"(?:\\.|[^"])+?"|[^",])+)
|
63
100
|
(?:,\s*|\Z)'xn).flatten
|
64
101
|
end
|
65
102
|
|
66
103
|
# Escapes HTTP reserved and unwise characters in +str+
|
67
104
|
def escape_uri(str)
|
68
105
|
str = str.dup
|
69
|
-
str
|
106
|
+
str = binary_encode(str)
|
70
107
|
str.gsub(UNESCAPED) { "%%%02X" % $1[0].ord }
|
71
108
|
end
|
72
109
|
|
73
110
|
# Unescapes HTTP reserved and unwise characters in +str+
|
74
111
|
def unescape_uri(str)
|
75
112
|
str = str.dup
|
76
|
-
str
|
113
|
+
str = binary_encode(str)
|
77
114
|
str.gsub(ESCAPED) { $1.hex.chr }
|
78
115
|
end
|
79
116
|
|
80
117
|
# Unescape form encoded values in +str+
|
81
118
|
def unescape_form(str)
|
82
119
|
str = str.dup
|
83
|
-
str
|
120
|
+
str = binary_encode(str)
|
84
121
|
str.gsub!(/\+/, ' ')
|
85
122
|
str.gsub(ESCAPED) { $1.hex.chr }
|
86
123
|
end
|
124
|
+
|
125
|
+
# Performs validation on the passed header hash and returns a string representation of the headers
|
126
|
+
def headers_hash_to_s(headers)
|
127
|
+
headers_str = String.new
|
128
|
+
headers.each do |key, values|
|
129
|
+
if key.to_s.match(/[\r\n]/)
|
130
|
+
raise Excon::Errors::InvalidHeaderKey.new(key.to_s.inspect + ' contains forbidden "\r" or "\n"')
|
131
|
+
end
|
132
|
+
[values].flatten.each do |value|
|
133
|
+
if value.to_s.match(/[\r\n]/)
|
134
|
+
# Don't include the potentially sensitive header value (i.e. authorization token) in the message
|
135
|
+
raise Excon::Errors::InvalidHeaderValue.new(key.to_s + ' header value contains forbidden "\r" or "\n"')
|
136
|
+
end
|
137
|
+
headers_str << key.to_s << ': ' << value.to_s << CR_NL
|
138
|
+
end
|
139
|
+
end
|
140
|
+
headers_str
|
141
|
+
end
|
87
142
|
end
|
88
143
|
end
|
data/lib/excon.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
3
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
4
|
|
@@ -11,6 +12,8 @@ require 'uri'
|
|
11
12
|
require 'zlib'
|
12
13
|
require 'stringio'
|
13
14
|
|
15
|
+
require 'excon/version'
|
16
|
+
|
14
17
|
require 'excon/extensions/uri'
|
15
18
|
|
16
19
|
require 'excon/middlewares/base'
|
@@ -20,11 +23,11 @@ require 'excon/middlewares/instrumentor'
|
|
20
23
|
require 'excon/middlewares/mock'
|
21
24
|
require 'excon/middlewares/response_parser'
|
22
25
|
|
26
|
+
require 'excon/error'
|
23
27
|
require 'excon/constants'
|
24
28
|
require 'excon/utils'
|
25
29
|
|
26
30
|
require 'excon/connection'
|
27
|
-
require 'excon/errors'
|
28
31
|
require 'excon/headers'
|
29
32
|
require 'excon/response'
|
30
33
|
require 'excon/middlewares/decompress'
|
@@ -34,7 +37,8 @@ require 'excon/middlewares/capture_cookies'
|
|
34
37
|
require 'excon/pretty_printer'
|
35
38
|
require 'excon/socket'
|
36
39
|
require 'excon/ssl_socket'
|
37
|
-
require 'excon/standard_instrumentor'
|
40
|
+
require 'excon/instrumentors/standard_instrumentor'
|
41
|
+
require 'excon/instrumentors/logging_instrumentor'
|
38
42
|
require 'excon/unix_socket'
|
39
43
|
|
40
44
|
# Define defaults first so they will be available to other files
|
@@ -55,10 +59,18 @@ module Excon
|
|
55
59
|
def display_warning(warning)
|
56
60
|
# Show warning if $VERBOSE or ENV['EXCON_DEBUG'] is set
|
57
61
|
if $VERBOSE || ENV['EXCON_DEBUG']
|
58
|
-
$stderr.puts
|
62
|
+
$stderr.puts "[excon][WARNING] #{warning}\n#{ caller.join("\n") }"
|
63
|
+
end
|
64
|
+
|
65
|
+
if @raise_on_warnings
|
66
|
+
raise Error::Warning.new(warning)
|
59
67
|
end
|
60
68
|
end
|
61
69
|
|
70
|
+
def set_raise_on_warnings!(should_raise)
|
71
|
+
@raise_on_warnings = should_raise
|
72
|
+
end
|
73
|
+
|
62
74
|
# Status of mocking
|
63
75
|
def mock
|
64
76
|
display_warning('Excon#mock is deprecated, use Excon.defaults[:mock] instead.')
|
@@ -101,12 +113,15 @@ module Excon
|
|
101
113
|
|
102
114
|
# @see Connection#initialize
|
103
115
|
# Initializes a new keep-alive session for a given remote host
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
116
|
+
# @param [String] url The destination URL
|
117
|
+
# @param [Hash<Symbol, >] params One or more option params to set on the Connection instance
|
118
|
+
# @return [Connection] A new Excon::Connection instance
|
107
119
|
def new(url, params = {})
|
108
120
|
uri_parser = params[:uri_parser] || defaults[:uri_parser]
|
109
121
|
uri = uri_parser.parse(url)
|
122
|
+
if params[:path]
|
123
|
+
uri_parser.parse(params[:path])
|
124
|
+
end
|
110
125
|
unless uri.scheme
|
111
126
|
raise ArgumentError.new("Invalid URI: #{uri}")
|
112
127
|
end
|
@@ -128,13 +143,13 @@ module Excon
|
|
128
143
|
end
|
129
144
|
|
130
145
|
# push an additional stub onto the list to check for mock requests
|
131
|
-
#
|
132
|
-
#
|
133
|
-
def stub(request_params = {}, response_params = nil)
|
134
|
-
if method = request_params.delete(:method)
|
146
|
+
# @param request_params [Hash<Symbol, >] request params to match against, omitted params match all
|
147
|
+
# @param response_params [Hash<Symbol, >] response params to return from matched request or block to call with params
|
148
|
+
def stub(request_params = {}, response_params = nil, &block)
|
149
|
+
if (method = request_params.delete(:method))
|
135
150
|
request_params[:method] = method.to_s.downcase.to_sym
|
136
151
|
end
|
137
|
-
if url = request_params.delete(:url)
|
152
|
+
if (url = request_params.delete(:url))
|
138
153
|
uri = URI.parse(url)
|
139
154
|
request_params = {
|
140
155
|
:host => uri.host,
|
@@ -146,7 +161,7 @@ module Excon
|
|
146
161
|
if uri.user || uri.password
|
147
162
|
request_params[:headers] ||= {}
|
148
163
|
user, pass = Utils.unescape_form(uri.user.to_s), Utils.unescape_form(uri.password.to_s)
|
149
|
-
request_params[:headers]['Authorization'] ||= 'Basic '
|
164
|
+
request_params[:headers]['Authorization'] ||= 'Basic ' + ["#{user}:#{pass}"].pack('m').delete(Excon::CR_NL)
|
150
165
|
end
|
151
166
|
end
|
152
167
|
if request_params.has_key?(:headers)
|
@@ -160,7 +175,7 @@ module Excon
|
|
160
175
|
if response_params
|
161
176
|
raise(ArgumentError.new("stub requires either response_params OR a block"))
|
162
177
|
else
|
163
|
-
stub = [request_params,
|
178
|
+
stub = [request_params, block]
|
164
179
|
end
|
165
180
|
elsif response_params
|
166
181
|
stub = [request_params, response_params]
|
@@ -172,10 +187,10 @@ module Excon
|
|
172
187
|
end
|
173
188
|
|
174
189
|
# get a stub matching params or nil
|
175
|
-
#
|
176
|
-
#
|
190
|
+
# @param request_params [Hash<Symbol, >] request params to match against, omitted params match all
|
191
|
+
# @return [Hash<Symbol, >] response params to return from matched request or block to call with params
|
177
192
|
def stub_for(request_params={})
|
178
|
-
if method = request_params.delete(:method)
|
193
|
+
if (method = request_params.delete(:method))
|
179
194
|
request_params[:method] = method.to_s.downcase.to_sym
|
180
195
|
end
|
181
196
|
Excon.stubs.each do |stub, response_params|
|
@@ -183,7 +198,7 @@ module Excon
|
|
183
198
|
headers_match = !stub.has_key?(:headers) || stub[:headers].keys.all? do |key|
|
184
199
|
case value = stub[:headers][key]
|
185
200
|
when Regexp
|
186
|
-
if match = value.match(request_params[:headers][key])
|
201
|
+
if (match = value.match(request_params[:headers][key]))
|
187
202
|
captures[:headers][key] = match.captures
|
188
203
|
end
|
189
204
|
match
|
@@ -194,7 +209,7 @@ module Excon
|
|
194
209
|
non_headers_match = (stub.keys - [:headers]).all? do |key|
|
195
210
|
case value = stub[key]
|
196
211
|
when Regexp
|
197
|
-
if match = value.match(request_params[key])
|
212
|
+
if (match = value.match(request_params[key]))
|
198
213
|
captures[key] = match.captures
|
199
214
|
end
|
200
215
|
match
|
@@ -221,8 +236,8 @@ module Excon
|
|
221
236
|
end
|
222
237
|
|
223
238
|
# remove first/oldest stub matching request_params
|
224
|
-
#
|
225
|
-
#
|
239
|
+
# @param request_params [Hash<Symbol, >] request params to match against, omitted params match all
|
240
|
+
# @return [Hash<Symbol, >] response params from deleted stub
|
226
241
|
def unstub(request_params = {})
|
227
242
|
stub = stub_for(request_params)
|
228
243
|
Excon.stubs.delete_at(Excon.stubs.index(stub))
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.88.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dpiddy (Dan Peterson)
|
8
8
|
- geemus (Wesley Beary)
|
9
9
|
- nextmat (Matt Sanders)
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.5.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 3.5.0
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: activesupport
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,55 +158,65 @@ dependencies:
|
|
144
158
|
requirements:
|
145
159
|
- - ">="
|
146
160
|
- !ruby/object:Gem::Version
|
147
|
-
version: 1.8.
|
161
|
+
version: 1.8.5
|
148
162
|
type: :development
|
149
163
|
prerelease: false
|
150
164
|
version_requirements: !ruby/object:Gem::Requirement
|
151
165
|
requirements:
|
152
166
|
- - ">="
|
153
167
|
- !ruby/object:Gem::Version
|
154
|
-
version: 1.8.
|
168
|
+
version: 1.8.5
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: puma
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
name: webrick
|
185
|
+
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
type: :development
|
191
|
+
prerelease: false
|
192
|
+
version_requirements: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
155
197
|
description: EXtended http(s) CONnections
|
156
198
|
email: geemus@gmail.com
|
157
199
|
executables: []
|
158
200
|
extensions: []
|
159
201
|
extra_rdoc_files:
|
160
202
|
- README.md
|
203
|
+
- CONTRIBUTORS.md
|
204
|
+
- CONTRIBUTING.md
|
161
205
|
files:
|
162
206
|
- CONTRIBUTING.md
|
163
207
|
- CONTRIBUTORS.md
|
164
|
-
- Gemfile
|
165
|
-
- Gemfile.lock
|
166
208
|
- LICENSE.md
|
167
209
|
- README.md
|
168
|
-
- Rakefile
|
169
|
-
- benchmarks/class_vs_lambda.rb
|
170
|
-
- benchmarks/concat_vs_insert.rb
|
171
|
-
- benchmarks/concat_vs_interpolate.rb
|
172
|
-
- benchmarks/cr_lf.rb
|
173
|
-
- benchmarks/downcase-eq-eq_vs_casecmp.rb
|
174
|
-
- benchmarks/excon.rb
|
175
|
-
- benchmarks/excon_vs.rb
|
176
|
-
- benchmarks/for_vs_array_each.rb
|
177
|
-
- benchmarks/for_vs_hash_each.rb
|
178
|
-
- benchmarks/has_key-vs-lookup.rb
|
179
|
-
- benchmarks/headers_case_sensitivity.rb
|
180
|
-
- benchmarks/headers_split_vs_match.rb
|
181
|
-
- benchmarks/implicit_block-vs-explicit_block.rb
|
182
|
-
- benchmarks/merging.rb
|
183
|
-
- benchmarks/single_vs_double_quotes.rb
|
184
|
-
- benchmarks/string_ranged_index.rb
|
185
|
-
- benchmarks/strip_newline.rb
|
186
|
-
- benchmarks/vs_stdlib.rb
|
187
|
-
- changelog.txt
|
188
210
|
- data/cacert.pem
|
189
211
|
- excon.gemspec
|
190
212
|
- lib/excon.rb
|
191
213
|
- lib/excon/connection.rb
|
192
214
|
- lib/excon/constants.rb
|
193
|
-
- lib/excon/
|
215
|
+
- lib/excon/error.rb
|
194
216
|
- lib/excon/extensions/uri.rb
|
195
217
|
- lib/excon/headers.rb
|
218
|
+
- lib/excon/instrumentors/logging_instrumentor.rb
|
219
|
+
- lib/excon/instrumentors/standard_instrumentor.rb
|
196
220
|
- lib/excon/middlewares/base.rb
|
197
221
|
- lib/excon/middlewares/capture_cookies.rb
|
198
222
|
- lib/excon/middlewares/decompress.rb
|
@@ -207,66 +231,25 @@ files:
|
|
207
231
|
- lib/excon/response.rb
|
208
232
|
- lib/excon/socket.rb
|
209
233
|
- lib/excon/ssl_socket.rb
|
210
|
-
- lib/excon/
|
234
|
+
- lib/excon/test/plugin/server/exec.rb
|
235
|
+
- lib/excon/test/plugin/server/puma.rb
|
236
|
+
- lib/excon/test/plugin/server/unicorn.rb
|
237
|
+
- lib/excon/test/plugin/server/webrick.rb
|
238
|
+
- lib/excon/test/server.rb
|
211
239
|
- lib/excon/unix_socket.rb
|
212
240
|
- lib/excon/utils.rb
|
213
|
-
-
|
214
|
-
- tests/bad_tests.rb
|
215
|
-
- tests/basic_tests.rb
|
216
|
-
- tests/complete_responses.rb
|
217
|
-
- tests/data/127.0.0.1.cert.crt
|
218
|
-
- tests/data/127.0.0.1.cert.key
|
219
|
-
- tests/data/excon.cert.crt
|
220
|
-
- tests/data/excon.cert.key
|
221
|
-
- tests/data/xs
|
222
|
-
- tests/errors_tests.rb
|
223
|
-
- tests/header_tests.rb
|
224
|
-
- tests/middlewares/canned_response_tests.rb
|
225
|
-
- tests/middlewares/capture_cookies_tests.rb
|
226
|
-
- tests/middlewares/decompress_tests.rb
|
227
|
-
- tests/middlewares/escape_path_tests.rb
|
228
|
-
- tests/middlewares/idempotent_tests.rb
|
229
|
-
- tests/middlewares/instrumentation_tests.rb
|
230
|
-
- tests/middlewares/mock_tests.rb
|
231
|
-
- tests/middlewares/redirect_follower_tests.rb
|
232
|
-
- tests/pipeline_tests.rb
|
233
|
-
- tests/proxy_tests.rb
|
234
|
-
- tests/query_string_tests.rb
|
235
|
-
- tests/rackups/basic.rb
|
236
|
-
- tests/rackups/basic.ru
|
237
|
-
- tests/rackups/basic_auth.ru
|
238
|
-
- tests/rackups/deflater.ru
|
239
|
-
- tests/rackups/proxy.ru
|
240
|
-
- tests/rackups/query_string.ru
|
241
|
-
- tests/rackups/redirecting.ru
|
242
|
-
- tests/rackups/redirecting_with_cookie.ru
|
243
|
-
- tests/rackups/request_headers.ru
|
244
|
-
- tests/rackups/request_methods.ru
|
245
|
-
- tests/rackups/response_header.ru
|
246
|
-
- tests/rackups/ssl.ru
|
247
|
-
- tests/rackups/ssl_mismatched_cn.ru
|
248
|
-
- tests/rackups/ssl_verify_peer.ru
|
249
|
-
- tests/rackups/streaming.ru
|
250
|
-
- tests/rackups/thread_safety.ru
|
251
|
-
- tests/rackups/timeout.ru
|
252
|
-
- tests/rackups/webrick_patch.rb
|
253
|
-
- tests/request_headers_tests.rb
|
254
|
-
- tests/request_method_tests.rb
|
255
|
-
- tests/request_tests.rb
|
256
|
-
- tests/response_tests.rb
|
257
|
-
- tests/servers/bad.rb
|
258
|
-
- tests/servers/eof.rb
|
259
|
-
- tests/servers/error.rb
|
260
|
-
- tests/servers/good.rb
|
261
|
-
- tests/test_helper.rb
|
262
|
-
- tests/thread_safety_tests.rb
|
263
|
-
- tests/timeout_tests.rb
|
264
|
-
- tests/utils_tests.rb
|
241
|
+
- lib/excon/version.rb
|
265
242
|
homepage: https://github.com/excon/excon
|
266
243
|
licenses:
|
267
244
|
- MIT
|
268
|
-
metadata:
|
269
|
-
|
245
|
+
metadata:
|
246
|
+
homepage_uri: https://github.com/excon/excon
|
247
|
+
bug_tracker_uri: https://github.com/excon/excon/issues
|
248
|
+
changelog_uri: https://github.com/excon/excon/blob/master/changelog.txt
|
249
|
+
documentation_uri: https://github.com/excon/excon/blob/master/README.md
|
250
|
+
source_code_uri: https://github.com/excon/excon
|
251
|
+
wiki_uri: https://github.com/excon/excon/wiki
|
252
|
+
post_install_message:
|
270
253
|
rdoc_options:
|
271
254
|
- "--charset=UTF-8"
|
272
255
|
require_paths:
|
@@ -282,9 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
265
|
- !ruby/object:Gem::Version
|
283
266
|
version: '0'
|
284
267
|
requirements: []
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
specification_version: 2
|
268
|
+
rubygems_version: 3.2.15
|
269
|
+
signing_key:
|
270
|
+
specification_version: 4
|
289
271
|
summary: speed, persistence, http(s)
|
290
272
|
test_files: []
|
data/Gemfile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
gem 'jruby-openssl', :platform => :jruby
|
6
|
-
gem 'unicorn', :platforms => [:mri, :rbx]
|
7
|
-
gem 'rubysl', '~> 2.0', :platform => :rbx
|
8
|
-
gem 'rack', '~> 1.6'
|
9
|
-
|
10
|
-
# group :benchmark do
|
11
|
-
# gem 'em-http-request'
|
12
|
-
# gem 'httparty'
|
13
|
-
# gem 'rest-client'
|
14
|
-
# gem 'tach'
|
15
|
-
# gem 'typhoeus'
|
16
|
-
# gem 'sinatra'
|
17
|
-
# gem 'streamly_ffi'
|
18
|
-
# gem 'curb'
|
19
|
-
# end
|