excon 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/cacert.pem +2 -87
- data/lib/excon/connection.rb +3 -3
- data/lib/excon/error.rb +2 -2
- data/lib/excon/middlewares/redirect_follower.rb +2 -2
- data/lib/excon/ssl_socket.rb +1 -1
- data/lib/excon/test/plugin/server/puma.rb +1 -1
- data/lib/excon/test/plugin/server/unicorn.rb +5 -5
- data/lib/excon/test/plugin/server/webrick.rb +1 -1
- data/lib/excon/test/server.rb +1 -1
- data/lib/excon/utils.rb +30 -33
- data/lib/excon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f78ec13c3b7cc67758d4f7f61d1c7ea4c53fbc7deaba119f2b4dac03f9db892
|
4
|
+
data.tar.gz: d52117b0d59efeb242703048d0ced7401a23aefe415c92a4e9698d3ca6ae95ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c08361f5c838c98d5f16ad4faa7b6d0fc74f5522e1a03f854a592f35c96f1a463e7946fdcf7e47d2861d52665bf7dfe6e8990e74d65f2a6f2fde2d5e2d410f
|
7
|
+
data.tar.gz: 7acdd19b51708652664484ffdbedd1ffc9f3f20816a8544771a8082b78d802ca1e052bea39b8be94cf9e20719e82aff7170f9a596db4f0549bfa54106faec68f
|
data/data/cacert.pem
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
2
|
## Bundle of CA Root Certificates
|
3
3
|
##
|
4
|
-
## Certificate data from Mozilla as of: Tue
|
4
|
+
## Certificate data from Mozilla as of: Tue Dec 31 04:12:05 2024 GMT
|
5
5
|
##
|
6
6
|
## Find updated versions here: https://curl.se/docs/caextract.html
|
7
7
|
##
|
@@ -16,7 +16,7 @@
|
|
16
16
|
## Just configure this file as the SSLCACertificateFile.
|
17
17
|
##
|
18
18
|
## Conversion done with mk-ca-bundle.pl version 1.29.
|
19
|
-
## SHA256:
|
19
|
+
## SHA256: c99d6d3f8d3d4e47719ba2b648992f5b58b150128d3aca3c05c566d8dc98e116
|
20
20
|
##
|
21
21
|
|
22
22
|
|
@@ -584,27 +584,6 @@ NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
|
|
584
584
|
dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
|
585
585
|
-----END CERTIFICATE-----
|
586
586
|
|
587
|
-
SecureSign RootCA11
|
588
|
-
===================
|
589
|
-
-----BEGIN CERTIFICATE-----
|
590
|
-
MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
|
591
|
-
SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
|
592
|
-
b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
|
593
|
-
KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
|
594
|
-
cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
|
595
|
-
TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
|
596
|
-
wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
|
597
|
-
g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
|
598
|
-
O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
|
599
|
-
bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
|
600
|
-
t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
|
601
|
-
OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
|
602
|
-
bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
|
603
|
-
Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
|
604
|
-
y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
|
605
|
-
lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
|
606
|
-
-----END CERTIFICATE-----
|
607
|
-
|
608
587
|
Microsec e-Szigno Root CA 2009
|
609
588
|
==============================
|
610
589
|
-----BEGIN CERTIFICATE-----
|
@@ -2319,40 +2298,6 @@ hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
|
|
2319
2298
|
dBb9HxEGmpv0
|
2320
2299
|
-----END CERTIFICATE-----
|
2321
2300
|
|
2322
|
-
Entrust Root Certification Authority - G4
|
2323
|
-
=========================================
|
2324
|
-
-----BEGIN CERTIFICATE-----
|
2325
|
-
MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
|
2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lYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
|
2351
|
-
JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
|
2352
|
-
+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
|
2353
|
-
kcpG2om3PVODLAgfi49T3f+sHw==
|
2354
|
-
-----END CERTIFICATE-----
|
2355
|
-
|
2356
2301
|
Microsoft ECC Root Certificate Authority 2017
|
2357
2302
|
=============================================
|
2358
2303
|
-----BEGIN CERTIFICATE-----
|
@@ -3170,36 +3115,6 @@ AwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozmut6Dacpps6kFtZaSF4fC0urQe87YQVt8
|
|
3170
3115
|
rgIwRt7qy12a7DLCZRawTDBcMPPaTnOGBtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
|
3171
3116
|
-----END CERTIFICATE-----
|
3172
3117
|
|
3173
|
-
Security Communication RootCA3
|
3174
|
-
==============================
|
3175
|
-
-----BEGIN CERTIFICATE-----
|
3176
|
-
MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNVBAYTAkpQMSUw
|
3177
|
-
IwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScwJQYDVQQDEx5TZWN1cml0eSBD
|
3178
|
-
b21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQsw
|
3179
|
-
CQYDVQQGEwJKUDElMCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UE
|
3180
|
-
AxMeU2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
|
3181
|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u0soo5iyG9kLFwfl9+qd9XbXv8S2gVj/yP9kaWJ5rW4O
|
3194
|
-
H3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQIUYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASx
|
3195
|
-
YfQAW0q3nHE3GYV5v4GwxxMOdnE+OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZ
|
3196
|
-
XSEIx2C/pHF7uNkegr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml
|
3197
|
-
+LLfiAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUVnuiZIesn
|
3198
|
-
KwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD2NCcnWXL0CsnMQMeNuE9
|
3199
|
-
dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI//1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm
|
3200
|
-
6Vwdp6POXiUyK+OVrCoHzrQoeIY8LaadTdJ0MN1kURXbg4NR16/9M51NZg==
|
3201
|
-
-----END CERTIFICATE-----
|
3202
|
-
|
3203
3118
|
Security Communication ECC RootCA1
|
3204
3119
|
==================================
|
3205
3120
|
-----BEGIN CERTIFICATE-----
|
data/lib/excon/connection.rb
CHANGED
@@ -159,7 +159,7 @@ module Excon
|
|
159
159
|
if chunk.length > 0
|
160
160
|
socket(datum).write(chunk.length.to_s(16) << CR_NL << chunk << CR_NL)
|
161
161
|
else
|
162
|
-
socket(datum).write(
|
162
|
+
socket(datum).write("0#{CR_NL}#{CR_NL}")
|
163
163
|
break
|
164
164
|
end
|
165
165
|
end
|
@@ -329,7 +329,7 @@ module Excon
|
|
329
329
|
# @param pipeline_params [Array<Hash>] An array of one or more optional params, override defaults set in Connection.new, see #request for details
|
330
330
|
def requests(pipeline_params)
|
331
331
|
pipeline_params.each {|params| params.merge!(:pipeline => true, :persistent => true) }
|
332
|
-
pipeline_params.last
|
332
|
+
pipeline_params.last[:persistent] = @data[:persistent]
|
333
333
|
|
334
334
|
responses = pipeline_params.map do |params|
|
335
335
|
request(params)
|
@@ -511,7 +511,7 @@ module Excon
|
|
511
511
|
end
|
512
512
|
|
513
513
|
def raise_socket_error(error)
|
514
|
-
if error.message
|
514
|
+
if error.message.include?('certificate verify failed')
|
515
515
|
raise(Excon::Errors::CertificateError.new(error))
|
516
516
|
else
|
517
517
|
raise(Excon::Errors::SocketError.new(error))
|
data/lib/excon/error.rb
CHANGED
@@ -216,8 +216,8 @@ or:
|
|
216
216
|
|
217
217
|
klasses.each do |klass|
|
218
218
|
class_name = klass.to_s
|
219
|
-
unless class_name
|
220
|
-
class_name = klass.to_s + 'Error' if class_name
|
219
|
+
unless class_name.match?(/Error\Z/)
|
220
|
+
class_name = klass.to_s + 'Error' if class_name.match?(legacy_re)
|
221
221
|
end
|
222
222
|
Excon::Errors.const_set(class_name, Excon::Error.const_get(klass))
|
223
223
|
end
|
@@ -67,8 +67,8 @@ module Excon
|
|
67
67
|
:query => uri.query
|
68
68
|
)
|
69
69
|
|
70
|
-
params
|
71
|
-
params
|
70
|
+
params[:user] = Utils.unescape_uri(uri.user) if uri.user
|
71
|
+
params[:password] = Utils.unescape_uri(uri.password) if uri.password
|
72
72
|
|
73
73
|
response = Excon::Connection.new(params).request
|
74
74
|
datum.merge!({
|
data/lib/excon/ssl_socket.rb
CHANGED
@@ -63,7 +63,7 @@ module Excon
|
|
63
63
|
unless ca_file || ca_path || cert_store
|
64
64
|
# workaround issue #257 (JRUBY-6970)
|
65
65
|
ca_file = DEFAULT_CA_FILE
|
66
|
-
ca_file = ca_file.gsub(/^jar:/, '') if ca_file
|
66
|
+
ca_file = ca_file.gsub(/^jar:/, '') if ca_file.match?(/^jar:file:\//)
|
67
67
|
|
68
68
|
begin
|
69
69
|
ssl_context.cert_store.add_file(ca_file)
|
@@ -7,7 +7,7 @@ module Excon
|
|
7
7
|
open_process(RbConfig.ruby, '-S', 'puma', '-b', bind_uri.to_s, app_str)
|
8
8
|
process_stderr = ""
|
9
9
|
line = ''
|
10
|
-
until line
|
10
|
+
until line.include?('Use Ctrl-C to stop')
|
11
11
|
line = read.gets
|
12
12
|
raise process_stderr if line.nil?
|
13
13
|
process_stderr << line
|
@@ -12,19 +12,19 @@ module Excon
|
|
12
12
|
host = bind_uri.host.gsub(/[\[\]]/, '')
|
13
13
|
bind_str = "#{host}:#{bind_uri.port}"
|
14
14
|
end
|
15
|
-
args = [
|
15
|
+
args = [
|
16
16
|
RbConfig.ruby,
|
17
17
|
'-S',
|
18
|
-
'unicorn',
|
19
|
-
'--no-default-middleware',
|
18
|
+
'unicorn',
|
19
|
+
'--no-default-middleware',
|
20
20
|
'-l',
|
21
|
-
bind_str,
|
21
|
+
bind_str,
|
22
22
|
app_str
|
23
23
|
]
|
24
24
|
open_process(*args)
|
25
25
|
process_stderr = ''
|
26
26
|
line = ''
|
27
|
-
until line
|
27
|
+
until line.include?('worker=0 ready')
|
28
28
|
line = error.gets
|
29
29
|
raise process_stderr if line.nil?
|
30
30
|
process_stderr << line
|
@@ -10,7 +10,7 @@ module Excon
|
|
10
10
|
open_process(RbConfig.ruby, '-S', 'rackup', '-s', 'webrick', '--host', host, '--port', port, app_str)
|
11
11
|
process_stderr = ""
|
12
12
|
line = ''
|
13
|
-
until line
|
13
|
+
until line.include?('HTTPServer#start')
|
14
14
|
line = error.gets
|
15
15
|
raise process_stderr if line.nil?
|
16
16
|
process_stderr << line
|
data/lib/excon/test/server.rb
CHANGED
@@ -73,7 +73,7 @@ module Excon
|
|
73
73
|
while (line = lines.shift)
|
74
74
|
case line
|
75
75
|
when /(ERROR|Error)/
|
76
|
-
unless line
|
76
|
+
unless line.match?(/(null cert chain|did not return a certificate|SSL_read:: internal error)/)
|
77
77
|
in_err = true
|
78
78
|
puts
|
79
79
|
end
|
data/lib/excon/utils.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Excon
|
3
4
|
module Utils
|
4
|
-
|
5
|
+
module_function
|
5
6
|
|
6
|
-
CONTROL = (0x0..0x1f).map
|
7
|
+
CONTROL = "#{(0x0..0x1f).map(&:chr).join}\u007F"
|
7
8
|
DELIMS = '<>#%"'
|
8
9
|
UNWISE = '{}|\\^[]`'
|
9
|
-
NONASCII = (0x80..0xff).map
|
10
|
-
UNESCAPED = /([#{
|
11
|
-
ESCAPED = /%([0-9a-fA-F]{2})
|
10
|
+
NONASCII = (0x80..0xff).map(&:chr).join
|
11
|
+
UNESCAPED = /([#{Regexp.escape("#{CONTROL} #{DELIMS}#{UNWISE}#{NONASCII}")}])/.freeze
|
12
|
+
ESCAPED = /%([0-9a-fA-F]{2})/.freeze
|
12
13
|
|
13
14
|
def binary_encode(string)
|
14
15
|
if FORCE_ENC && string.encoding != Encoding::ASCII_8BIT
|
@@ -23,9 +24,8 @@ module Excon
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def connection_uri(datum = @data)
|
26
|
-
unless datum
|
27
|
-
|
28
|
-
end
|
27
|
+
raise ArgumentError, '`datum` must be given unless called on a Connection' unless datum
|
28
|
+
|
29
29
|
if datum[:scheme] == UNIX
|
30
30
|
"#{datum[:scheme]}://#{datum[:socket]}"
|
31
31
|
else
|
@@ -36,21 +36,15 @@ module Excon
|
|
36
36
|
# Redact sensitive info from provided data
|
37
37
|
def redact(datum)
|
38
38
|
datum = datum.dup
|
39
|
-
if datum.
|
40
|
-
if datum[:headers].
|
39
|
+
if datum.key?(:headers)
|
40
|
+
if datum[:headers].key?('Authorization') || datum[:headers].key?('Proxy-Authorization')
|
41
41
|
datum[:headers] = datum[:headers].dup
|
42
42
|
end
|
43
|
-
if datum[:headers].
|
44
|
-
|
45
|
-
end
|
46
|
-
if datum[:headers].has_key?('Proxy-Authorization')
|
47
|
-
datum[:headers]['Proxy-Authorization'] = REDACTED
|
48
|
-
end
|
43
|
+
datum[:headers]['Authorization'] = REDACTED if datum[:headers].key?('Authorization')
|
44
|
+
datum[:headers]['Proxy-Authorization'] = REDACTED if datum[:headers].key?('Proxy-Authorization')
|
49
45
|
end
|
50
|
-
if datum.
|
51
|
-
|
52
|
-
end
|
53
|
-
if datum.has_key?(:proxy) && datum[:proxy] && datum[:proxy].has_key?(:password)
|
46
|
+
datum[:password] = REDACTED if datum.key?(:password)
|
47
|
+
if datum.key?(:proxy) && datum[:proxy]&.key?(:password)
|
54
48
|
datum[:proxy] = datum[:proxy].dup
|
55
49
|
datum[:proxy][:password] = REDACTED
|
56
50
|
end
|
@@ -76,13 +70,13 @@ module Excon
|
|
76
70
|
end
|
77
71
|
|
78
72
|
def query_string(datum)
|
79
|
-
str =
|
73
|
+
str = +''
|
80
74
|
case datum[:query]
|
81
75
|
when String
|
82
76
|
str << '?' << datum[:query]
|
83
77
|
when Hash
|
84
78
|
str << '?'
|
85
|
-
datum[:query].sort_by {|k,_| k.to_s }.each do |key, values|
|
79
|
+
datum[:query].sort_by { |k, _| k.to_s }.each do |key, values|
|
86
80
|
key = CGI.escape(key.to_s)
|
87
81
|
if values.nil?
|
88
82
|
str << key << '&'
|
@@ -100,46 +94,49 @@ module Excon
|
|
100
94
|
# Splits a header value +str+ according to HTTP specification.
|
101
95
|
def split_header_value(str)
|
102
96
|
return [] if str.nil?
|
97
|
+
|
103
98
|
str = str.dup.strip
|
104
99
|
str = binary_encode(str)
|
105
|
-
str.scan(
|
106
|
-
(?:,\s*|\Z)
|
100
|
+
str.scan(/\G((?:"(?:\\.|[^"])+?"|[^",])+)
|
101
|
+
(?:,\s*|\Z)/xn).flatten
|
107
102
|
end
|
108
103
|
|
109
104
|
# Escapes HTTP reserved and unwise characters in +str+
|
110
105
|
def escape_uri(str)
|
111
106
|
str = str.dup
|
112
107
|
str = binary_encode(str)
|
113
|
-
str.gsub(UNESCAPED) {
|
108
|
+
str.gsub(UNESCAPED) { format('%%%02X', ::Regexp.last_match(1)[0].ord) }
|
114
109
|
end
|
115
110
|
|
116
111
|
# Unescapes HTTP reserved and unwise characters in +str+
|
117
112
|
def unescape_uri(str)
|
118
113
|
str = str.dup
|
119
114
|
str = binary_encode(str)
|
120
|
-
str.gsub(ESCAPED) {
|
115
|
+
str.gsub(ESCAPED) { ::Regexp.last_match(1).hex.chr }
|
121
116
|
end
|
122
117
|
|
123
118
|
# Unescape form encoded values in +str+
|
124
119
|
def unescape_form(str)
|
125
120
|
str = str.dup
|
126
121
|
str = binary_encode(str)
|
127
|
-
str.
|
128
|
-
str.gsub(ESCAPED) {
|
122
|
+
str.tr!('+', ' ')
|
123
|
+
str.gsub(ESCAPED) { ::Regexp.last_match(1).hex.chr }
|
129
124
|
end
|
130
125
|
|
131
126
|
# Performs validation on the passed header hash and returns a string representation of the headers
|
132
127
|
def headers_hash_to_s(headers)
|
133
|
-
headers_str =
|
128
|
+
headers_str = +''
|
134
129
|
headers.each do |key, values|
|
135
|
-
if key.to_s.match(/[\r\n]/)
|
136
|
-
raise Excon::Errors::InvalidHeaderKey
|
130
|
+
if key.to_s.match?(/[\r\n]/)
|
131
|
+
raise Excon::Errors::InvalidHeaderKey, "#{key.to_s.inspect} contains forbidden \"\\r\" or \"\\n\""
|
137
132
|
end
|
133
|
+
|
138
134
|
[values].flatten.each do |value|
|
139
|
-
if value.to_s.match(/[\r\n]/)
|
135
|
+
if value.to_s.match?(/[\r\n]/)
|
140
136
|
# Don't include the potentially sensitive header value (i.e. authorization token) in the message
|
141
|
-
raise Excon::Errors::InvalidHeaderValue
|
137
|
+
raise Excon::Errors::InvalidHeaderValue, "#{key} header value contains forbidden \"\\r\" or \"\\n\""
|
142
138
|
end
|
139
|
+
|
143
140
|
headers_str << key.to_s << ': ' << value.to_s << CR_NL
|
144
141
|
end
|
145
142
|
end
|
data/lib/excon/version.rb
CHANGED
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: 1.2.
|
4
|
+
version: 1.2.3
|
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:
|
13
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|