excon 0.109.0 → 0.111.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/data/cacert.pem +66 -32
- data/excon.gemspec +1 -0
- data/lib/excon/connection.rb +0 -1
- data/lib/excon/constants.rb +114 -118
- data/lib/excon/version.rb +1 -1
- data/lib/excon.rb +36 -47
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09b9d8be1f0954461960791f025122147f57ac828e24adb25cd63b7f0d520a4d'
|
4
|
+
data.tar.gz: 55f4fd066a2afdac2aecde07b7d91f3e564a89a5d0680e967a5227ca8171eafc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33469a58ddb269ffe4cf35066ec7c2e87921aacd49a4766ae85fbe7bdc0d7f1b26ee287838cd07ff322d008327c7ef7edf8cda0015a7a48a1b6a9c6537a4df1e
|
7
|
+
data.tar.gz: 65e294c562e75540e33f5555060289afeafb84024acbedc482d5efa526136605f45612972576ebc1612f3483d65290134a65709bcdd8ec3dfefdab015b62e556
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@ Usable, fast, simple Ruby HTTP 1.1
|
|
4
4
|
|
5
5
|
Excon was designed to be simple, fast and performant. It works great as a general HTTP(s) client and is particularly well suited to usage in API clients.
|
6
6
|
|
7
|
-
[![Build Status](https://github.com/excon/excon/actions/workflows/
|
8
|
-
[![Gem Version](https://badge.fury.io/rb/excon.svg)](https://
|
7
|
+
[![Build Status](https://github.com/excon/excon/actions/workflows/ci.yml/badge.svg)](https://github.com/excon/excon/actions/workflows/ci.yml)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/excon.svg)](https://rubygems.org/gems/excon)
|
9
9
|
|
10
10
|
- [Getting Started](#getting-started)
|
11
11
|
- [Options](#options)
|
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 Jul 2 03:12:04 2024 GMT
|
5
5
|
##
|
6
6
|
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7
7
|
## (CA). These were automatically extracted from Mozilla's root certificates
|
@@ -14,7 +14,7 @@
|
|
14
14
|
## Just configure this file as the SSLCACertificateFile.
|
15
15
|
##
|
16
16
|
## Conversion done with mk-ca-bundle.pl version 1.29.
|
17
|
-
## SHA256:
|
17
|
+
## SHA256: 456ff095dde6dd73354c5c28c73d9c06f53b61a803963414cb91a1d92945cdd3
|
18
18
|
##
|
19
19
|
|
20
20
|
|
@@ -2600,36 +2600,6 @@ vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+
|
|
2600
2600
|
CAezNIm8BZ/3Hobui3A=
|
2601
2601
|
-----END CERTIFICATE-----
|
2602
2602
|
|
2603
|
-
GLOBALTRUST 2020
|
2604
|
-
================
|
2605
|
-
-----BEGIN CERTIFICATE-----
|
2606
|
-
MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkGA1UEBhMCQVQx
|
2607
|
-
IzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVT
|
2608
|
-
VCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYxMDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAh
|
2609
|
-
BgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAy
|
2610
|
-
MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3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DKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd6IwPS3BD0IL/qMy/pJTAvoe9
|
2624
|
-
iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS
|
2625
|
-
8cE54+X1+NZK3TTN+2/BT+MAi1bikvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2
|
2626
|
-
HcqtbepBEX4tdJP7wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxS
|
2627
|
-
vTOBTI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6CMUO+1918
|
2628
|
-
oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn4rnvyOL2NSl6dPrFf4IF
|
2629
|
-
YqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+IaFvowdlxfv1k7/9nR4hYJS8+hge9+6jl
|
2630
|
-
gqispdNpQ80xiEmEU5LAsTkbOYMBMMTyqfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
|
2631
|
-
-----END CERTIFICATE-----
|
2632
|
-
|
2633
2603
|
ANF Secure Server Root CA
|
2634
2604
|
=========================
|
2635
2605
|
-----BEGIN CERTIFICATE-----
|
@@ -3532,3 +3502,67 @@ dVwPaFsdZcJfMw8eD/A7hvWwTruc9+olBdytoptLFwG+Qt81IR2tq670v64fG9PiO/yzcnMcmyiQ
|
|
3532
3502
|
iRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17Org3bhzjlP1v9mxnhMUF6cKojawHhRUzN
|
3533
3503
|
lM47ni3niAIi9G7oyOzWPPO5std3eqx7
|
3534
3504
|
-----END CERTIFICATE-----
|
3505
|
+
|
3506
|
+
Telekom Security TLS ECC Root 2020
|
3507
|
+
==================================
|
3508
|
+
-----BEGIN CERTIFICATE-----
|
3509
|
+
MIICQjCCAcmgAwIBAgIQNjqWjMlcsljN0AFdxeVXADAKBggqhkjOPQQDAzBjMQswCQYDVQQGEwJE
|
3510
|
+
RTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0eSBHbWJIMSswKQYDVQQDDCJUZWxl
|
3511
|
+
a29tIFNlY3VyaXR5IFRMUyBFQ0MgUm9vdCAyMDIwMB4XDTIwMDgyNTA3NDgyMFoXDTQ1MDgyNTIz
|
3512
|
+
NTk1OVowYzELMAkGA1UEBhMCREUxJzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkg
|
3513
|
+
R21iSDErMCkGA1UEAwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgRUNDIFJvb3QgMjAyMDB2MBAGByqG
|
3514
|
+
SM49AgEGBSuBBAAiA2IABM6//leov9Wq9xCazbzREaK9Z0LMkOsVGJDZos0MKiXrPk/OtdKPD/M1
|
3515
|
+
2kOLAoC+b1EkHQ9rK8qfwm9QMuU3ILYg/4gND21Ju9sGpIeQkpT0CdDPf8iAC8GXs7s1J8nCG6NC
|
3516
|
+
MEAwHQYDVR0OBBYEFONyzG6VmUex5rNhTNHLq+O6zd6fMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
|
3517
|
+
AQH/BAQDAgEGMAoGCCqGSM49BAMDA2cAMGQCMHVSi7ekEE+uShCLsoRbQuHmKjYC2qBuGT8lv9pZ
|
3518
|
+
Mo7k+5Dck2TOrbRBR2Diz6fLHgIwN0GMZt9Ba9aDAEH9L1r3ULRn0SyocddDypwnJJGDSA3PzfdU
|
3519
|
+
ga/sf+Rn27iQ7t0l
|
3520
|
+
-----END CERTIFICATE-----
|
3521
|
+
|
3522
|
+
Telekom Security TLS RSA Root 2023
|
3523
|
+
==================================
|
3524
|
+
-----BEGIN CERTIFICATE-----
|
3525
|
+
MIIFszCCA5ugAwIBAgIQIZxULej27HF3+k7ow3BX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u/WU48IxK63nI1bMNSWSs1A=
|
3551
|
+
-----END CERTIFICATE-----
|
3552
|
+
|
3553
|
+
FIRMAPROFESIONAL CA ROOT-A WEB
|
3554
|
+
==============================
|
3555
|
+
-----BEGIN CERTIFICATE-----
|
3556
|
+
MIICejCCAgCgAwIBAgIQMZch7a+JQn81QYehZ1ZMbTAKBggqhkjOPQQDAzBuMQswCQYDVQQGEwJF
|
3557
|
+
UzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UEYQwPVkFURVMtQTYyNjM0MDY4
|
3558
|
+
MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENBIFJPT1QtQSBXRUIwHhcNMjIwNDA2MDkwMTM2
|
3559
|
+
WhcNNDcwMzMxMDkwMTM2WjBuMQswCQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25h
|
3560
|
+
bCBTQTEYMBYGA1UEYQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFM
|
3561
|
+
IENBIFJPT1QtQSBXRUIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARHU+osEaR3xyrq89Zfe9MEkVz6
|
3562
|
+
iMYiuYMQYneEMy3pA4jU4DP37XcsSmDq5G+tbbT4TIqk5B/K6k84Si6CcyvHZpsKjECcfIr28jlg
|
3563
|
+
st7L7Ljkb+qbXbdTkBgyVcUgt5SjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUk+FD
|
3564
|
+
Y1w8ndYn81LsF7Kpryz3dvgwHQYDVR0OBBYEFJPhQ2NcPJ3WJ/NS7Beyqa8s93b4MA4GA1UdDwEB
|
3565
|
+
/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjAdfKR7w4l1M+E7qUW/Runpod3JIha3RxEL2Jq68cgL
|
3566
|
+
cFBTApFwhVmpHqTm6iMxoAACMQD94vizrxa5HnPEluPBMBnYfubDl94cT7iJLzPrSA8Z94dGXSaQ
|
3567
|
+
pYXFuXqUPoeovQA=
|
3568
|
+
-----END CERTIFICATE-----
|
data/excon.gemspec
CHANGED
data/lib/excon/connection.rb
CHANGED
data/lib/excon/constants.rb
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Excon
|
3
|
-
|
4
3
|
CR_NL = "\r\n"
|
5
4
|
|
6
|
-
DEFAULT_CA_FILE = File.expand_path(File.join(File.dirname(__FILE__),
|
5
|
+
DEFAULT_CA_FILE = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'data', 'cacert.pem'))
|
7
6
|
|
8
|
-
DEFAULT_CHUNK_SIZE =
|
7
|
+
DEFAULT_CHUNK_SIZE = 1_048_576 # 1 megabyte
|
9
8
|
|
10
9
|
# avoid overwrite if somebody has redefined
|
11
|
-
unless const_defined?(:CHUNK_SIZE)
|
12
|
-
CHUNK_SIZE = DEFAULT_CHUNK_SIZE
|
13
|
-
end
|
10
|
+
CHUNK_SIZE = DEFAULT_CHUNK_SIZE unless const_defined?(:CHUNK_SIZE)
|
14
11
|
|
15
12
|
DEFAULT_REDIRECT_LIMIT = 10
|
16
13
|
|
@@ -20,13 +17,13 @@ module Excon
|
|
20
17
|
Excon::Error::Timeout,
|
21
18
|
Excon::Error::Socket,
|
22
19
|
Excon::Error::HTTPStatus
|
23
|
-
]
|
20
|
+
].freeze
|
24
21
|
|
25
22
|
FORCE_ENC = CR_NL.respond_to?(:force_encoding)
|
26
23
|
|
27
24
|
HTTP_1_1 = " HTTP/1.1\r\n"
|
28
25
|
|
29
|
-
HTTP_VERBS = %w
|
26
|
+
HTTP_VERBS = %w[connect delete get head options patch post put trace].freeze
|
30
27
|
|
31
28
|
HTTPS = 'https'
|
32
29
|
|
@@ -40,89 +37,89 @@ module Excon
|
|
40
37
|
|
41
38
|
VERSIONS = "#{USER_AGENT} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
|
42
39
|
|
43
|
-
VALID_REQUEST_KEYS = [
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
]
|
70
|
-
|
71
|
-
VALID_CONNECTION_KEYS = VALID_REQUEST_KEYS + [
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
40
|
+
VALID_REQUEST_KEYS = %i[
|
41
|
+
allow_unstubbed_requests
|
42
|
+
body
|
43
|
+
chunk_size
|
44
|
+
debug_request
|
45
|
+
debug_response
|
46
|
+
dns_timeouts
|
47
|
+
headers
|
48
|
+
instrumentor
|
49
|
+
logger
|
50
|
+
method
|
51
|
+
middlewares
|
52
|
+
password
|
53
|
+
path
|
54
|
+
persistent
|
55
|
+
pipeline
|
56
|
+
query
|
57
|
+
read_timeout
|
58
|
+
request_block
|
59
|
+
resolv_resolver
|
60
|
+
response_block
|
61
|
+
stubs
|
62
|
+
timeout
|
63
|
+
user
|
64
|
+
versions
|
65
|
+
write_timeout
|
66
|
+
].freeze
|
67
|
+
|
68
|
+
VALID_CONNECTION_KEYS = VALID_REQUEST_KEYS + %i[
|
69
|
+
ciphers
|
70
|
+
client_key
|
71
|
+
client_key_data
|
72
|
+
client_key_pass
|
73
|
+
client_cert
|
74
|
+
client_cert_data
|
75
|
+
client_chain
|
76
|
+
client_chain_data
|
77
|
+
certificate
|
78
|
+
certificate_path
|
79
|
+
disable_proxy
|
80
|
+
private_key
|
81
|
+
private_key_path
|
82
|
+
connect_timeout
|
83
|
+
family
|
84
|
+
keepalive
|
85
|
+
host
|
86
|
+
hostname
|
87
|
+
omit_default_port
|
88
|
+
nonblock
|
89
|
+
reuseaddr
|
90
|
+
port
|
91
|
+
proxy
|
92
|
+
scheme
|
93
|
+
socket
|
94
|
+
ssl_ca_file
|
95
|
+
ssl_ca_path
|
96
|
+
ssl_cert_store
|
97
|
+
ssl_verify_callback
|
98
|
+
ssl_verify_peer
|
99
|
+
ssl_verify_peer_host
|
100
|
+
ssl_verify_hostname
|
101
|
+
ssl_version
|
102
|
+
ssl_min_version
|
103
|
+
ssl_max_version
|
104
|
+
ssl_security_level
|
105
|
+
ssl_proxy_headers
|
106
|
+
ssl_uri_schemes
|
107
|
+
tcp_nodelay
|
108
|
+
thread_safe_sockets
|
109
|
+
uri_parser
|
113
110
|
]
|
114
111
|
|
115
112
|
DEPRECATED_VALID_REQUEST_KEYS = {
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
}
|
113
|
+
captures: 'Mock',
|
114
|
+
expects: 'Expects',
|
115
|
+
idempotent: 'Idempotent',
|
116
|
+
instrumentor_name: 'Instrumentor',
|
117
|
+
mock: 'Mock',
|
118
|
+
retries_remaining: 'Idempotent', # referenced in Instrumentor, but only relevant with Idempotent
|
119
|
+
retry_errors: 'Idempotent',
|
120
|
+
retry_interval: 'Idempotent',
|
121
|
+
retry_limit: 'Idempotent' # referenced in Instrumentor, but only relevant with Idempotent
|
122
|
+
}.freeze
|
126
123
|
|
127
124
|
unless ::IO.const_defined?(:WaitReadable)
|
128
125
|
class ::IO
|
@@ -135,47 +132,46 @@ module Excon
|
|
135
132
|
module WaitWritable; end
|
136
133
|
end
|
137
134
|
end
|
135
|
+
|
138
136
|
# these come last as they rely on the above
|
139
137
|
DEFAULTS = {
|
140
|
-
:
|
138
|
+
chunk_size: CHUNK_SIZE || DEFAULT_CHUNK_SIZE,
|
141
139
|
# see https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28default.29
|
142
140
|
# list provided then had DES related things sorted to the end
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
146
|
-
:
|
147
|
-
:
|
148
|
-
|
149
|
-
: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, # nil allows Resolv::DNS default timeout value (see https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
|
146
|
+
headers: {
|
150
147
|
'User-Agent' => USER_AGENT,
|
151
|
-
'Accept'
|
148
|
+
'Accept' => '*/*'
|
152
149
|
},
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
150
|
+
idempotent: false,
|
151
|
+
instrumentor_name: 'excon',
|
152
|
+
middlewares: [
|
156
153
|
Excon::Middleware::ResponseParser,
|
157
154
|
Excon::Middleware::Expects,
|
158
155
|
Excon::Middleware::Idempotent,
|
159
156
|
Excon::Middleware::Instrumentor,
|
160
157
|
Excon::Middleware::Mock
|
161
158
|
],
|
162
|
-
:
|
163
|
-
:
|
164
|
-
:
|
165
|
-
:
|
166
|
-
:
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
170
|
-
:
|
171
|
-
:
|
172
|
-
:
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
178
|
-
:
|
159
|
+
mock: false,
|
160
|
+
nonblock: true,
|
161
|
+
omit_default_port: false,
|
162
|
+
persistent: false,
|
163
|
+
read_timeout: 60,
|
164
|
+
resolv_resolver: nil,
|
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
|
+
timeout: nil,
|
173
|
+
uri_parser: URI,
|
174
|
+
versions: VERSIONS,
|
175
|
+
write_timeout: 60
|
179
176
|
}
|
180
|
-
|
181
177
|
end
|
data/lib/excon/version.rb
CHANGED
data/lib/excon.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
$:.unshift(File.dirname(__FILE__)) unless
|
3
4
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
4
5
|
|
5
6
|
require 'cgi'
|
6
7
|
require 'forwardable'
|
8
|
+
require 'ipaddr'
|
7
9
|
require 'openssl'
|
8
10
|
require 'rbconfig'
|
9
11
|
require 'socket'
|
@@ -44,7 +46,6 @@ require 'excon/unix_socket'
|
|
44
46
|
# Define defaults first so they will be available to other files
|
45
47
|
module Excon
|
46
48
|
class << self
|
47
|
-
|
48
49
|
# @return [Hash] defaults for Excon connections
|
49
50
|
def defaults
|
50
51
|
@defaults ||= DEFAULTS
|
@@ -52,19 +53,15 @@ module Excon
|
|
52
53
|
|
53
54
|
# Change defaults for Excon connections
|
54
55
|
# @return [Hash] defaults for Excon connections
|
55
|
-
|
56
|
-
@defaults = new_defaults
|
57
|
-
end
|
56
|
+
attr_writer :defaults
|
58
57
|
|
59
58
|
def display_warning(warning)
|
60
59
|
# Show warning if $VERBOSE or ENV['EXCON_DEBUG'] is set
|
61
|
-
|
62
|
-
$stderr.puts "[excon][WARNING] #{warning}\n#{ caller.join("\n") }"
|
63
|
-
end
|
60
|
+
($VERBOSE || ENV['EXCON_DEBUG']) && Warning.warn("[excon][WARNING] #{warning}\n#{caller.join("\n")}")
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
return unless @raise_on_warnings
|
63
|
+
|
64
|
+
raise(Error::Warning, warning)
|
68
65
|
end
|
69
66
|
|
70
67
|
def set_raise_on_warnings!(should_raise)
|
@@ -119,32 +116,25 @@ module Excon
|
|
119
116
|
def new(url, params = {})
|
120
117
|
uri_parser = params[:uri_parser] || defaults[:uri_parser]
|
121
118
|
uri = uri_parser.parse(url)
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
unless uri.scheme
|
126
|
-
raise ArgumentError.new("Invalid URI: #{uri}")
|
127
|
-
end
|
119
|
+
params[:path] && uri_parser.parse(params[:path])
|
120
|
+
raise(ArgumentError, "Invalid URI: #{uri}") unless uri.scheme
|
121
|
+
|
128
122
|
params = {
|
129
|
-
:
|
130
|
-
:
|
131
|
-
:
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
123
|
+
host: uri.host,
|
124
|
+
hostname: uri.hostname,
|
125
|
+
path: uri.path,
|
126
|
+
port: uri.port,
|
127
|
+
query: uri.query,
|
128
|
+
scheme: uri.scheme
|
135
129
|
}.merge(params)
|
136
|
-
|
137
|
-
|
138
|
-
end
|
139
|
-
if uri.user
|
140
|
-
params[:user] = Utils.unescape_uri(uri.user)
|
141
|
-
end
|
130
|
+
uri.password && params[:password] = Utils.unescape_uri(uri.password)
|
131
|
+
uri.user && params[:user] = Utils.unescape_uri(uri.user)
|
142
132
|
Excon::Connection.new(params)
|
143
133
|
end
|
144
134
|
|
145
135
|
# push an additional stub onto the list to check for mock requests
|
146
136
|
# @param request_params [Hash<Symbol, >] request params to match against, omitted params match all
|
147
|
-
# @param response_params [Hash<Symbol, >] response params to return
|
137
|
+
# @param response_params [Hash<Symbol, >] response params to return or block to call with matched params
|
148
138
|
def stub(request_params = {}, response_params = nil, &block)
|
149
139
|
if (method = request_params.delete(:method))
|
150
140
|
request_params[:method] = method.to_s.downcase.to_sym
|
@@ -152,19 +142,20 @@ module Excon
|
|
152
142
|
if (url = request_params.delete(:url))
|
153
143
|
uri = URI.parse(url)
|
154
144
|
request_params = {
|
155
|
-
:
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
145
|
+
host: uri.host,
|
146
|
+
path: uri.path,
|
147
|
+
port: uri.port,
|
148
|
+
query: uri.query,
|
149
|
+
scheme: uri.scheme
|
160
150
|
}.merge!(request_params)
|
161
151
|
if uri.user || uri.password
|
162
152
|
request_params[:headers] ||= {}
|
163
|
-
user
|
153
|
+
user = Utils.unescape_form(uri.user.to_s)
|
154
|
+
pass = Utils.unescape_form(uri.password.to_s)
|
164
155
|
request_params[:headers]['Authorization'] ||= 'Basic ' + ["#{user}:#{pass}"].pack('m').delete(Excon::CR_NL)
|
165
156
|
end
|
166
157
|
end
|
167
|
-
if request_params.
|
158
|
+
if request_params.key?(:headers)
|
168
159
|
headers = Excon::Headers.new
|
169
160
|
request_params[:headers].each do |key, value|
|
170
161
|
headers[key] = value
|
@@ -172,15 +163,13 @@ module Excon
|
|
172
163
|
request_params[:headers] = headers
|
173
164
|
end
|
174
165
|
if block_given?
|
175
|
-
if response_params
|
176
|
-
|
177
|
-
|
178
|
-
stub = [request_params, block]
|
179
|
-
end
|
166
|
+
raise(ArgumentError, 'stub requires either response_params OR a block') if response_params
|
167
|
+
|
168
|
+
stub = [request_params, block]
|
180
169
|
elsif response_params
|
181
170
|
stub = [request_params, response_params]
|
182
171
|
else
|
183
|
-
raise(ArgumentError
|
172
|
+
raise(ArgumentError, 'stub requires either response_params OR a block')
|
184
173
|
end
|
185
174
|
stubs.unshift(stub)
|
186
175
|
stub
|
@@ -194,8 +183,8 @@ module Excon
|
|
194
183
|
request_params[:method] = method.to_s.downcase.to_sym
|
195
184
|
end
|
196
185
|
Excon.stubs.each do |stub, response_params|
|
197
|
-
captures = { :
|
198
|
-
headers_match = !stub.
|
186
|
+
captures = { headers: {} }
|
187
|
+
headers_match = !stub.key?(:headers) || stub[:headers].keys.all? do |key|
|
199
188
|
case value = stub[:headers][key]
|
200
189
|
when Regexp
|
201
190
|
case request_params[:headers][key]
|
@@ -249,9 +238,9 @@ module Excon
|
|
249
238
|
# @param request_params [Hash<Symbol, >] request params to match against, omitted params match all
|
250
239
|
# @return [Hash<Symbol, >] response params from deleted stub
|
251
240
|
def unstub(request_params = {})
|
252
|
-
|
253
|
-
|
254
|
-
|
241
|
+
return unless (stub = stub_for(request_params))
|
242
|
+
|
243
|
+
Excon.stubs.delete_at(Excon.stubs.index(stub))
|
255
244
|
end
|
256
245
|
|
257
246
|
# Generic non-persistent HTTP methods
|
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.
|
4
|
+
version: 0.111.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: 2024-
|
13
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -244,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
244
|
requirements:
|
245
245
|
- - ">="
|
246
246
|
- !ruby/object:Gem::Version
|
247
|
-
version:
|
247
|
+
version: 2.7.0
|
248
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
249
|
requirements:
|
250
250
|
- - ">="
|