vagrant-unbundled 2.2.18.0 → 2.2.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +6 -6
- data/contrib/zsh/generate_zsh_completion.rb +2 -2
- data/lib/vagrant/errors.rb +8 -0
- data/plugins/commands/upload/command.rb +1 -1
- data/plugins/guests/atomic/guest.rb +1 -1
- data/plugins/guests/coreos/cap/configure_networks.rb +65 -0
- data/plugins/guests/darwin/cap/mount_smb_shared_folder.rb +6 -3
- data/plugins/guests/suse/cap/halt.rb +5 -1
- data/plugins/guests/windows/cap/rsync.rb +5 -1
- data/plugins/hosts/darwin/cap/path.rb +4 -0
- data/plugins/hosts/darwin/cap/version.rb +23 -0
- data/plugins/hosts/darwin/plugin.rb +5 -0
- data/plugins/hosts/windows/cap/ssh.rb +1 -1
- data/plugins/providers/virtualbox/action/network.rb +39 -2
- data/plugins/provisioners/chef/cap/freebsd/chef_installed.rb +5 -3
- data/plugins/provisioners/chef/cap/linux/chef_installed.rb +5 -3
- data/plugins/provisioners/chef/cap/omnios/chef_installed.rb +7 -5
- data/plugins/provisioners/chef/cap/windows/chef_installed.rb +3 -2
- data/templates/locales/en.yml +25 -0
- data/vagrant.gemspec +1 -1
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/CONTRIBUTING.md +23 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/CONTRIBUTORS.md +140 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/README.md +492 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/data/cacert.pem +3232 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/excon.gemspec +45 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/connection.rb +599 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/constants.rb +172 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/error.rb +229 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/extensions/uri.rb +34 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/headers.rb +85 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/instrumentors/logging_instrumentor.rb +48 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/instrumentors/standard_instrumentor.rb +21 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/base.rb +31 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/capture_cookies.rb +32 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/decompress.rb +44 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/escape_path.rb +12 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/expects.rb +25 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/idempotent.rb +57 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/instrumentor.rb +49 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/mock.rb +61 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/redirect_follower.rb +87 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/middlewares/response_parser.rb +16 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/pretty_printer.rb +39 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/response.rb +234 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/socket.rb +297 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/ssl_socket.rb +194 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/test/plugin/server/exec.rb +26 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/test/plugin/server/puma.rb +23 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/test/plugin/server/unicorn.rb +40 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/test/plugin/server/webrick.rb +26 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/test/server.rb +106 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/unix_socket.rb +42 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/utils.rb +143 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/version.rb +4 -0
- data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon.rb +255 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/README.md +122 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/base.rb +289 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/cache.rb +113 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/cache_file.rb +36 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/cascade.rb +56 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/chain.rb +130 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/fallbacks.rb +97 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/flatten.rb +118 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/gettext.rb +85 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/interpolation_compiler.rb +123 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/key_value.rb +206 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/memoize.rb +54 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/metadata.rb +71 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/pluralization.rb +55 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/simple.rb +108 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend/transliterator.rb +108 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/backend.rb +21 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/config.rb +165 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/core_ext/hash.rb +59 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/exceptions.rb +111 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/gettext/helpers.rb +75 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/gettext/po_parser.rb +329 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/gettext.rb +28 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/interpolate/ruby.rb +39 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/fallbacks.rb +99 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/tag/parents.rb +24 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/tag/rfc4646.rb +74 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/tag/simple.rb +39 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale/tag.rb +28 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/locale.rb +8 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/middleware.rb +17 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/basics.rb +60 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/defaults.rb +52 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/interpolation.rb +163 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/link.rb +66 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/localization/date.rb +117 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/localization/date_time.rb +103 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/localization/procs.rb +117 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/localization/time.rb +103 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/localization.rb +19 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/lookup.rb +81 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/pluralization.rb +35 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests/procs.rb +60 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/tests.rb +14 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n/version.rb +5 -0
- data/vendor/bundle/ruby/3.0.0/gems/i18n-1.8.11/lib/i18n.rb +415 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/Code-of-Conduct.md +73 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/Contributing.md +132 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/History.md +269 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/Licence.md +25 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/Manifest.txt +31 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/README.rdoc +194 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/Rakefile +270 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/type/columnar.rb +57 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/type.rb +634 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/_columnar.rb +137 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/cache.rb +58 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/columnar.rb +3 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/container.rb +96 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/deprecations.rb +36 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/full.rb +19 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/loader.rb +159 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/logger.rb +37 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types/registry.rb +90 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime/types.rb +233 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/lib/mime-types.rb +3 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/bad-fixtures/malformed +9 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/fixture/json.json +1 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/fixture/old-data +9 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/fixture/yaml.yaml +55 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/minitest_helper.rb +11 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/test_mime_type.rb +621 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/test_mime_types.rb +169 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/test_mime_types_cache.rb +118 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/test_mime_types_class.rb +159 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/test_mime_types_lazy.rb +49 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-3.4.1/test/test_mime_types_loader.rb +32 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/Code-of-Conduct.md +75 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/Contributing.md +241 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/History.md +494 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/Licence.md +24 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/Manifest.txt +34 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/README.md +73 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/Rakefile +155 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/content_type_mime.db +878 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/ext_mime.db +1198 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime-types.json +1 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.content_type.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.docs.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.encoding.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.flags.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.friendly.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.pext.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.use_instead.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/data/mime.xrefs.column +2376 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/lib/mime/types/data.rb +21 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/lib/mime-types-data.rb +3 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/application.yaml +17254 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/audio.yaml +1716 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/chemical.yaml +71 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/conference.yaml +9 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/drawing.yaml +15 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/font.yaml +65 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/image.yaml +1251 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/message.yaml +200 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/model.yaml +390 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/multipart.yaml +179 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/provisional-standard-types.yaml +129 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/text.yaml +1166 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/video.yaml +1121 -0
- data/vendor/bundle/ruby/3.0.0/gems/mime-types-data-3.2021.1115/types/world.yaml +8 -0
- data/vendor/bundle/ruby/3.0.0/specifications/excon-0.89.0.gemspec +58 -0
- data/vendor/bundle/ruby/3.0.0/specifications/i18n-1.8.11.gemspec +32 -0
- data/vendor/bundle/ruby/3.0.0/specifications/mime-types-3.4.1.gemspec +63 -0
- data/vendor/bundle/ruby/3.0.0/specifications/mime-types-data-3.2021.1115.gemspec +54 -0
- data/version.txt +1 -1
- metadata +157 -4
@@ -0,0 +1,172 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Excon
|
3
|
+
|
4
|
+
CR_NL = "\r\n"
|
5
|
+
|
6
|
+
DEFAULT_CA_FILE = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "data", "cacert.pem"))
|
7
|
+
|
8
|
+
DEFAULT_CHUNK_SIZE = 1048576 # 1 megabyte
|
9
|
+
|
10
|
+
# avoid overwrite if somebody has redefined
|
11
|
+
unless const_defined?(:CHUNK_SIZE)
|
12
|
+
CHUNK_SIZE = DEFAULT_CHUNK_SIZE
|
13
|
+
end
|
14
|
+
|
15
|
+
DEFAULT_REDIRECT_LIMIT = 10
|
16
|
+
|
17
|
+
DEFAULT_RETRY_LIMIT = 4
|
18
|
+
|
19
|
+
DEFAULT_RETRY_ERRORS = [
|
20
|
+
Excon::Error::Timeout,
|
21
|
+
Excon::Error::Socket,
|
22
|
+
Excon::Error::HTTPStatus
|
23
|
+
]
|
24
|
+
|
25
|
+
FORCE_ENC = CR_NL.respond_to?(:force_encoding)
|
26
|
+
|
27
|
+
HTTP_1_1 = " HTTP/1.1\r\n"
|
28
|
+
|
29
|
+
HTTP_VERBS = %w{connect delete get head options patch post put trace}
|
30
|
+
|
31
|
+
HTTPS = 'https'
|
32
|
+
|
33
|
+
NO_ENTITY = [204, 205, 304].freeze
|
34
|
+
|
35
|
+
REDACTED = 'REDACTED'
|
36
|
+
|
37
|
+
UNIX = 'unix'
|
38
|
+
|
39
|
+
USER_AGENT = "excon/#{VERSION}"
|
40
|
+
|
41
|
+
VERSIONS = "#{USER_AGENT} (#{RUBY_PLATFORM}) ruby/#{RUBY_VERSION}"
|
42
|
+
|
43
|
+
VALID_REQUEST_KEYS = [
|
44
|
+
:allow_unstubbed_requests,
|
45
|
+
:body,
|
46
|
+
:chunk_size,
|
47
|
+
:debug_request,
|
48
|
+
:debug_response,
|
49
|
+
:headers,
|
50
|
+
:instrumentor, # Used for setting logging within Connection
|
51
|
+
:logger,
|
52
|
+
:method,
|
53
|
+
:middlewares,
|
54
|
+
:password,
|
55
|
+
:path,
|
56
|
+
:persistent,
|
57
|
+
:pipeline,
|
58
|
+
:query,
|
59
|
+
:read_timeout,
|
60
|
+
:request_block,
|
61
|
+
:response_block,
|
62
|
+
:stubs,
|
63
|
+
:user,
|
64
|
+
:versions,
|
65
|
+
:write_timeout
|
66
|
+
]
|
67
|
+
|
68
|
+
VALID_CONNECTION_KEYS = VALID_REQUEST_KEYS + [
|
69
|
+
:ciphers,
|
70
|
+
:client_key,
|
71
|
+
:client_key_data,
|
72
|
+
:client_key_pass,
|
73
|
+
:client_cert,
|
74
|
+
:client_cert_data,
|
75
|
+
:certificate,
|
76
|
+
:certificate_path,
|
77
|
+
:disable_proxy,
|
78
|
+
:private_key,
|
79
|
+
:private_key_path,
|
80
|
+
:connect_timeout,
|
81
|
+
:family,
|
82
|
+
:keepalive,
|
83
|
+
:host,
|
84
|
+
:hostname,
|
85
|
+
:omit_default_port,
|
86
|
+
:nonblock,
|
87
|
+
:reuseaddr,
|
88
|
+
:port,
|
89
|
+
:proxy,
|
90
|
+
:scheme,
|
91
|
+
:socket,
|
92
|
+
:ssl_ca_file,
|
93
|
+
:ssl_ca_path,
|
94
|
+
:ssl_cert_store,
|
95
|
+
:ssl_verify_callback,
|
96
|
+
:ssl_verify_peer,
|
97
|
+
:ssl_verify_peer_host,
|
98
|
+
:ssl_verify_hostname,
|
99
|
+
:ssl_version,
|
100
|
+
:ssl_min_version,
|
101
|
+
:ssl_max_version,
|
102
|
+
:ssl_security_level,
|
103
|
+
:ssl_proxy_headers,
|
104
|
+
:ssl_uri_schemes,
|
105
|
+
:tcp_nodelay,
|
106
|
+
:thread_safe_sockets,
|
107
|
+
:uri_parser,
|
108
|
+
]
|
109
|
+
|
110
|
+
DEPRECATED_VALID_REQUEST_KEYS = {
|
111
|
+
:captures => 'Mock',
|
112
|
+
:expects => 'Expects',
|
113
|
+
:idempotent => 'Idempotent',
|
114
|
+
:instrumentor_name => 'Instrumentor',
|
115
|
+
:mock => 'Mock',
|
116
|
+
:retries_remaining => 'Idempotent', # referenced in Instrumentor, but only relevant with Idempotent
|
117
|
+
:retry_errors => 'Idempotent',
|
118
|
+
:retry_interval => 'Idempotent',
|
119
|
+
:retry_limit => 'Idempotent' # referenced in Instrumentor, but only relevant with Idempotent
|
120
|
+
}
|
121
|
+
|
122
|
+
unless ::IO.const_defined?(:WaitReadable)
|
123
|
+
class ::IO
|
124
|
+
module WaitReadable; end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
unless ::IO.const_defined?(:WaitWritable)
|
129
|
+
class ::IO
|
130
|
+
module WaitWritable; end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
# these come last as they rely on the above
|
134
|
+
DEFAULTS = {
|
135
|
+
:chunk_size => CHUNK_SIZE || DEFAULT_CHUNK_SIZE,
|
136
|
+
# see https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28default.29
|
137
|
+
# list provided then had DES related things sorted to the end
|
138
|
+
: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',
|
139
|
+
:connect_timeout => 60,
|
140
|
+
:debug_request => false,
|
141
|
+
:debug_response => false,
|
142
|
+
:headers => {
|
143
|
+
'User-Agent' => USER_AGENT,
|
144
|
+
'Accept' => '*/*'
|
145
|
+
},
|
146
|
+
:idempotent => false,
|
147
|
+
:instrumentor_name => 'excon',
|
148
|
+
:middlewares => [
|
149
|
+
Excon::Middleware::ResponseParser,
|
150
|
+
Excon::Middleware::Expects,
|
151
|
+
Excon::Middleware::Idempotent,
|
152
|
+
Excon::Middleware::Instrumentor,
|
153
|
+
Excon::Middleware::Mock
|
154
|
+
],
|
155
|
+
:mock => false,
|
156
|
+
:nonblock => true,
|
157
|
+
:omit_default_port => false,
|
158
|
+
:persistent => false,
|
159
|
+
:read_timeout => 60,
|
160
|
+
:retry_errors => DEFAULT_RETRY_ERRORS,
|
161
|
+
:retry_limit => DEFAULT_RETRY_LIMIT,
|
162
|
+
:ssl_verify_peer => true,
|
163
|
+
:ssl_uri_schemes => [HTTPS],
|
164
|
+
:stubs => :global,
|
165
|
+
:tcp_nodelay => false,
|
166
|
+
:thread_safe_sockets => true,
|
167
|
+
:uri_parser => URI,
|
168
|
+
:versions => VERSIONS,
|
169
|
+
:write_timeout => 60
|
170
|
+
}
|
171
|
+
|
172
|
+
end
|
@@ -0,0 +1,229 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Excon
|
3
|
+
# Excon exception classes
|
4
|
+
class Error < StandardError
|
5
|
+
@default_status_error = :HTTPStatus
|
6
|
+
|
7
|
+
class StubNotFound < Error; end
|
8
|
+
class InvalidStub < Error; end
|
9
|
+
class Warning < Error; end
|
10
|
+
|
11
|
+
# Socket related errors
|
12
|
+
class Socket < Error
|
13
|
+
attr_reader :socket_error
|
14
|
+
|
15
|
+
def initialize(socket_error = Excon::Error.new)
|
16
|
+
if is_a?(Certificate) || is_a?(Excon::Errors::CertificateError)
|
17
|
+
super
|
18
|
+
else
|
19
|
+
super("#{socket_error.message} (#{socket_error.class})")
|
20
|
+
set_backtrace(socket_error.backtrace)
|
21
|
+
@socket_error = socket_error
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Certificate related errors
|
27
|
+
class Certificate < Socket
|
28
|
+
def initialize(socket_error = Excon::Error.new)
|
29
|
+
msg = <<-EOL
|
30
|
+
Unable to verify certificate. This may be an issue with the remote host or with Excon. Excon has certificates bundled, but these can be customized:
|
31
|
+
|
32
|
+
`Excon.defaults[:ssl_ca_path] = path_to_certs`
|
33
|
+
`ENV['SSL_CERT_DIR'] = path_to_certs`
|
34
|
+
`Excon.defaults[:ssl_ca_file] = path_to_file`
|
35
|
+
`ENV['SSL_CERT_FILE'] = path_to_file`
|
36
|
+
`Excon.defaults[:ssl_verify_callback] = callback`
|
37
|
+
(see OpenSSL::SSL::SSLContext#verify_callback)
|
38
|
+
or:
|
39
|
+
`Excon.defaults[:ssl_verify_peer] = false` (less secure).
|
40
|
+
EOL
|
41
|
+
full_message = "#{socket_error.message} (#{socket_error.class})" +
|
42
|
+
' ' + msg
|
43
|
+
super(full_message)
|
44
|
+
set_backtrace(socket_error.backtrace)
|
45
|
+
@socket_error = socket_error
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class InvalidHeaderKey < Error; end
|
50
|
+
class InvalidHeaderValue < Error; end
|
51
|
+
class Timeout < Error; end
|
52
|
+
class ResponseParse < Error; end
|
53
|
+
|
54
|
+
class ProxyConnectionError < Error
|
55
|
+
attr_reader :request, :response
|
56
|
+
|
57
|
+
def initialize(msg, request = nil, response = nil)
|
58
|
+
super(msg)
|
59
|
+
@request = request
|
60
|
+
@response = response
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class ProxyParse < Error; end
|
65
|
+
class TooManyRedirects < Error; end
|
66
|
+
|
67
|
+
# Base class for HTTP Error classes
|
68
|
+
class HTTPStatus < Error
|
69
|
+
attr_reader :request, :response
|
70
|
+
|
71
|
+
def initialize(msg, request = nil, response = nil)
|
72
|
+
super(msg)
|
73
|
+
@request = request
|
74
|
+
@response = response
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# HTTP Error classes
|
79
|
+
class Informational < HTTPStatus; end
|
80
|
+
class Success < HTTPStatus; end
|
81
|
+
class Redirection < HTTPStatus; end
|
82
|
+
class Client < HTTPStatus; end
|
83
|
+
class Server < HTTPStatus; end
|
84
|
+
|
85
|
+
class Continue < Informational; end # 100
|
86
|
+
class SwitchingProtocols < Informational; end # 101
|
87
|
+
class OK < Success; end # 200
|
88
|
+
class Created < Success; end # 201
|
89
|
+
class Accepted < Success; end # 202
|
90
|
+
class NonAuthoritativeInformation < Success; end # 203
|
91
|
+
class NoContent < Success; end # 204
|
92
|
+
class ResetContent < Success; end # 205
|
93
|
+
class PartialContent < Success; end # 206
|
94
|
+
class MultipleChoices < Redirection; end # 300
|
95
|
+
class MovedPermanently < Redirection; end # 301
|
96
|
+
class Found < Redirection; end # 302
|
97
|
+
class SeeOther < Redirection; end # 303
|
98
|
+
class NotModified < Redirection; end # 304
|
99
|
+
class UseProxy < Redirection; end # 305
|
100
|
+
class TemporaryRedirect < Redirection; end # 307
|
101
|
+
class BadRequest < Client; end # 400
|
102
|
+
class Unauthorized < Client; end # 401
|
103
|
+
class PaymentRequired < Client; end # 402
|
104
|
+
class Forbidden < Client; end # 403
|
105
|
+
class NotFound < Client; end # 404
|
106
|
+
class MethodNotAllowed < Client; end # 405
|
107
|
+
class NotAcceptable < Client; end # 406
|
108
|
+
class ProxyAuthenticationRequired < Client; end # 407
|
109
|
+
class RequestTimeout < Client; end # 408
|
110
|
+
class Conflict < Client; end # 409
|
111
|
+
class Gone < Client; end # 410
|
112
|
+
class LengthRequired < Client; end # 411
|
113
|
+
class PreconditionFailed < Client; end # 412
|
114
|
+
class RequestEntityTooLarge < Client; end # 413
|
115
|
+
class RequestURITooLong < Client; end # 414
|
116
|
+
class UnsupportedMediaType < Client; end # 415
|
117
|
+
class RequestedRangeNotSatisfiable < Client; end # 416
|
118
|
+
class ExpectationFailed < Client; end # 417
|
119
|
+
class UnprocessableEntity < Client; end # 422
|
120
|
+
class TooManyRequests < Client; end # 429
|
121
|
+
class InternalServerError < Server; end # 500
|
122
|
+
class NotImplemented < Server; end # 501
|
123
|
+
class BadGateway < Server; end # 502
|
124
|
+
class ServiceUnavailable < Server; end # 503
|
125
|
+
class GatewayTimeout < Server; end # 504
|
126
|
+
|
127
|
+
def self.status_errors
|
128
|
+
@status_errors ||= {
|
129
|
+
100 => [Excon::Error::Continue, 'Continue'],
|
130
|
+
101 => [Excon::Error::SwitchingProtocols, 'Switching Protocols'],
|
131
|
+
200 => [Excon::Error::OK, 'OK'],
|
132
|
+
201 => [Excon::Error::Created, 'Created'],
|
133
|
+
202 => [Excon::Error::Accepted, 'Accepted'],
|
134
|
+
203 => [Excon::Error::NonAuthoritativeInformation, 'Non-Authoritative Information'],
|
135
|
+
204 => [Excon::Error::NoContent, 'No Content'],
|
136
|
+
205 => [Excon::Error::ResetContent, 'Reset Content'],
|
137
|
+
206 => [Excon::Error::PartialContent, 'Partial Content'],
|
138
|
+
300 => [Excon::Error::MultipleChoices, 'Multiple Choices'],
|
139
|
+
301 => [Excon::Error::MovedPermanently, 'Moved Permanently'],
|
140
|
+
302 => [Excon::Error::Found, 'Found'],
|
141
|
+
303 => [Excon::Error::SeeOther, 'See Other'],
|
142
|
+
304 => [Excon::Error::NotModified, 'Not Modified'],
|
143
|
+
305 => [Excon::Error::UseProxy, 'Use Proxy'],
|
144
|
+
307 => [Excon::Error::TemporaryRedirect, 'Temporary Redirect'],
|
145
|
+
400 => [Excon::Error::BadRequest, 'Bad Request'],
|
146
|
+
401 => [Excon::Error::Unauthorized, 'Unauthorized'],
|
147
|
+
402 => [Excon::Error::PaymentRequired, 'Payment Required'],
|
148
|
+
403 => [Excon::Error::Forbidden, 'Forbidden'],
|
149
|
+
404 => [Excon::Error::NotFound, 'Not Found'],
|
150
|
+
405 => [Excon::Error::MethodNotAllowed, 'Method Not Allowed'],
|
151
|
+
406 => [Excon::Error::NotAcceptable, 'Not Acceptable'],
|
152
|
+
407 => [Excon::Error::ProxyAuthenticationRequired, 'Proxy Authentication Required'],
|
153
|
+
408 => [Excon::Error::RequestTimeout, 'Request Timeout'],
|
154
|
+
409 => [Excon::Error::Conflict, 'Conflict'],
|
155
|
+
410 => [Excon::Error::Gone, 'Gone'],
|
156
|
+
411 => [Excon::Error::LengthRequired, 'Length Required'],
|
157
|
+
412 => [Excon::Error::PreconditionFailed, 'Precondition Failed'],
|
158
|
+
413 => [Excon::Error::RequestEntityTooLarge, 'Request Entity Too Large'],
|
159
|
+
414 => [Excon::Error::RequestURITooLong, 'Request-URI Too Long'],
|
160
|
+
415 => [Excon::Error::UnsupportedMediaType, 'Unsupported Media Type'],
|
161
|
+
416 => [Excon::Error::RequestedRangeNotSatisfiable, 'Request Range Not Satisfiable'],
|
162
|
+
417 => [Excon::Error::ExpectationFailed, 'Expectation Failed'],
|
163
|
+
422 => [Excon::Error::UnprocessableEntity, 'Unprocessable Entity'],
|
164
|
+
429 => [Excon::Error::TooManyRequests, 'Too Many Requests'],
|
165
|
+
500 => [Excon::Error::InternalServerError, 'InternalServerError'],
|
166
|
+
501 => [Excon::Error::NotImplemented, 'Not Implemented'],
|
167
|
+
502 => [Excon::Error::BadGateway, 'Bad Gateway'],
|
168
|
+
503 => [Excon::Error::ServiceUnavailable, 'Service Unavailable'],
|
169
|
+
504 => [Excon::Error::GatewayTimeout, 'Gateway Timeout']
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
# Messages for nicer exceptions, from rfc2616
|
174
|
+
def self.status_error(request, response)
|
175
|
+
error_class, error_message = status_errors[response[:status]]
|
176
|
+
if error_class.nil?
|
177
|
+
default_class = Excon::Error.const_get(@default_status_error)
|
178
|
+
error_class, error_message = [default_class, 'Unknown']
|
179
|
+
end
|
180
|
+
message = StringIO.new
|
181
|
+
str = "Expected(#{request[:expects].inspect}) <=>" +
|
182
|
+
" Actual(#{response[:status]} #{error_message})"
|
183
|
+
message.puts(str)
|
184
|
+
if request[:debug_request]
|
185
|
+
message.puts('excon.error.request')
|
186
|
+
Excon::PrettyPrinter.pp(message, request)
|
187
|
+
end
|
188
|
+
|
189
|
+
if request[:debug_response]
|
190
|
+
message.puts('excon.error.response')
|
191
|
+
Excon::PrettyPrinter.pp(message, response.data)
|
192
|
+
end
|
193
|
+
message.rewind
|
194
|
+
error_class.new(message.read, request, response)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# Legacy
|
199
|
+
module Errors
|
200
|
+
Excon::Errors::Error = Excon::Error
|
201
|
+
|
202
|
+
legacy_re = /
|
203
|
+
\A
|
204
|
+
Client
|
205
|
+
|Server
|
206
|
+
|Socket
|
207
|
+
|Certificate
|
208
|
+
|HTTPStatus
|
209
|
+
|InternalServer
|
210
|
+
\Z
|
211
|
+
/x
|
212
|
+
|
213
|
+
klasses = Excon::Error.constants.select do |c|
|
214
|
+
Excon::Error.const_get(c).is_a? Class
|
215
|
+
end
|
216
|
+
|
217
|
+
klasses.each do |klass|
|
218
|
+
class_name = klass.to_s
|
219
|
+
unless class_name =~ /Error\Z/
|
220
|
+
class_name = klass.to_s + 'Error' if class_name =~ legacy_re
|
221
|
+
end
|
222
|
+
Excon::Errors.const_set(class_name, Excon::Error.const_get(klass))
|
223
|
+
end
|
224
|
+
|
225
|
+
def self.status_error(request, response)
|
226
|
+
Excon::Error.status_error(request, response)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# TODO: Remove this monkey patch once ruby 1.9.3+ is the minimum supported version.
|
3
|
+
#
|
4
|
+
# This patch backports URI#hostname to ruby 1.9.2 and older.
|
5
|
+
# URI#hostname is used for IPv6 support in Excon.
|
6
|
+
#
|
7
|
+
# URI#hostname was added in stdlib in v1_9_3_0 in this commit:
|
8
|
+
# https://github.com/ruby/ruby/commit/5fd45a4b79dd26f9e7b6dc41142912df911e4d7d
|
9
|
+
#
|
10
|
+
# Addressable::URI is also an URI parser accepted in some parts of Excon.
|
11
|
+
# Addressable::URI#hostname was added in addressable-2.3.5+ in this commit:
|
12
|
+
# https://github.com/sporkmonger/addressable/commit/1b94abbec1f914d5f707c92a10efbb9e69aab65e
|
13
|
+
#
|
14
|
+
# Users who want to use Addressable::URI to parse URIs must upgrade to 2.3.5 or newer.
|
15
|
+
require 'uri'
|
16
|
+
unless URI("http://foo/bar").respond_to?(:hostname)
|
17
|
+
module URI
|
18
|
+
class Generic
|
19
|
+
# extract the host part of the URI and unwrap brackets for IPv6 addresses.
|
20
|
+
#
|
21
|
+
# This method is same as URI::Generic#host except
|
22
|
+
# brackets for IPv6 (and future IP) addresses are removed.
|
23
|
+
#
|
24
|
+
# u = URI("http://[::1]/bar")
|
25
|
+
# p u.hostname #=> "::1"
|
26
|
+
# p u.host #=> "[::1]"
|
27
|
+
#
|
28
|
+
def hostname
|
29
|
+
v = self.host
|
30
|
+
/\A\[(.*)\]\z/ =~ v ? $1 : v
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Excon
|
3
|
+
class Headers < Hash
|
4
|
+
|
5
|
+
SENTINEL = {}
|
6
|
+
|
7
|
+
alias_method :raw_writer, :[]=
|
8
|
+
alias_method :raw_reader, :[]
|
9
|
+
if SENTINEL.respond_to?(:assoc)
|
10
|
+
alias_method :raw_assoc, :assoc
|
11
|
+
end
|
12
|
+
alias_method :raw_delete, :delete
|
13
|
+
alias_method :raw_fetch, :fetch
|
14
|
+
alias_method :raw_has_key?, :has_key?
|
15
|
+
alias_method :raw_include?, :include?
|
16
|
+
alias_method :raw_key?, :key?
|
17
|
+
alias_method :raw_member?, :member?
|
18
|
+
alias_method :raw_merge, :merge
|
19
|
+
alias_method :raw_merge!, :merge!
|
20
|
+
alias_method :raw_rehash, :rehash
|
21
|
+
alias_method :raw_store, :store
|
22
|
+
alias_method :raw_values_at, :values_at
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
super
|
26
|
+
@downcased = {}
|
27
|
+
end
|
28
|
+
|
29
|
+
def [](key)
|
30
|
+
@downcased[key.to_s.downcase]
|
31
|
+
end
|
32
|
+
|
33
|
+
def []=(key, value)
|
34
|
+
raw_writer(key, value)
|
35
|
+
@downcased[key.to_s.downcase] = value
|
36
|
+
end
|
37
|
+
alias_method :store, :[]=
|
38
|
+
|
39
|
+
if SENTINEL.respond_to? :assoc
|
40
|
+
def assoc(obj)
|
41
|
+
@downcased.assoc(obj.downcase)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete(key, &proc)
|
46
|
+
raw_delete(key, &proc)
|
47
|
+
@downcased.delete(key.to_s.downcase, &proc)
|
48
|
+
end
|
49
|
+
|
50
|
+
def fetch(key, default = nil, &proc)
|
51
|
+
if proc
|
52
|
+
@downcased.fetch(key.to_s.downcase, &proc)
|
53
|
+
else
|
54
|
+
@downcased.fetch(key.to_s.downcase, default)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def has_key?(key)
|
59
|
+
raw_key?(key) || @downcased.has_key?(key.to_s.downcase)
|
60
|
+
end
|
61
|
+
alias_method :key?, :has_key?
|
62
|
+
alias_method :member?, :has_key?
|
63
|
+
|
64
|
+
def merge(other_hash)
|
65
|
+
self.dup.merge!(other_hash)
|
66
|
+
end
|
67
|
+
|
68
|
+
def merge!(other_hash)
|
69
|
+
other_hash.each do |key, value|
|
70
|
+
self[key] = value
|
71
|
+
end
|
72
|
+
raw_merge!(other_hash)
|
73
|
+
end
|
74
|
+
|
75
|
+
def rehash
|
76
|
+
@downcased.rehash
|
77
|
+
raw_rehash
|
78
|
+
end
|
79
|
+
|
80
|
+
def values_at(*keys)
|
81
|
+
@downcased.values_at(*keys.map {|key| key.to_s.downcase})
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/instrumentors/logging_instrumentor.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Excon
|
4
|
+
class LoggingInstrumentor
|
5
|
+
|
6
|
+
def self.instrument(name, params = {})
|
7
|
+
params = params.dup
|
8
|
+
|
9
|
+
logger = params[:logger] || Logger.new($stderr)
|
10
|
+
|
11
|
+
# reduce duplication/noise of output
|
12
|
+
params.delete(:connection)
|
13
|
+
params.delete(:stack)
|
14
|
+
|
15
|
+
if params.has_key?(:headers) && params[:headers].has_key?('Authorization')
|
16
|
+
params[:headers] = params[:headers].dup
|
17
|
+
params[:headers]['Authorization'] = "REDACTED"
|
18
|
+
end
|
19
|
+
|
20
|
+
if params.has_key?(:password)
|
21
|
+
params[:password] = "REDACTED"
|
22
|
+
end
|
23
|
+
|
24
|
+
if name.include?('request')
|
25
|
+
info = "request: " + params[:scheme] + "://" + File.join(params[:host], params[:path])
|
26
|
+
|
27
|
+
if params[:query]
|
28
|
+
info << "?"
|
29
|
+
|
30
|
+
if params[:query].is_a?(Hash)
|
31
|
+
info << params[:query].to_a.map { |key,value| "#{key}=#{value}" }.join('&')
|
32
|
+
else
|
33
|
+
info << params[:query]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
37
|
+
response_type = name.split('.').last
|
38
|
+
if params[:body]
|
39
|
+
info = "#{response_type}: " + params[:body]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
logger.info(info) if info
|
44
|
+
|
45
|
+
yield if block_given?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/vendor/bundle/ruby/3.0.0/gems/excon-0.89.0/lib/excon/instrumentors/standard_instrumentor.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Excon
|
3
|
+
class StandardInstrumentor
|
4
|
+
def self.instrument(name, params = {})
|
5
|
+
params = params.dup
|
6
|
+
|
7
|
+
# reduce duplication/noise of output
|
8
|
+
params.delete(:connection)
|
9
|
+
params.delete(:stack)
|
10
|
+
|
11
|
+
params = Utils.redact(params)
|
12
|
+
|
13
|
+
$stderr.puts(name)
|
14
|
+
Excon::PrettyPrinter.pp($stderr, params)
|
15
|
+
|
16
|
+
if block_given?
|
17
|
+
yield
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Excon
|
3
|
+
module Middleware
|
4
|
+
class Base
|
5
|
+
# Returns the list of parameters that this middleware uses that are valid
|
6
|
+
# as arguments to `Connection#request` or `Connection#new`.
|
7
|
+
def self.valid_parameter_keys
|
8
|
+
[]
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(stack)
|
12
|
+
@stack = stack
|
13
|
+
end
|
14
|
+
|
15
|
+
def error_call(datum)
|
16
|
+
# do stuff
|
17
|
+
@stack.error_call(datum)
|
18
|
+
end
|
19
|
+
|
20
|
+
def request_call(datum)
|
21
|
+
# do stuff
|
22
|
+
@stack.request_call(datum)
|
23
|
+
end
|
24
|
+
|
25
|
+
def response_call(datum)
|
26
|
+
@stack.response_call(datum)
|
27
|
+
# do stuff
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Excon
|
3
|
+
module Middleware
|
4
|
+
class CaptureCookies < Excon::Middleware::Base
|
5
|
+
|
6
|
+
def extract_cookies_from_set_cookie(set_cookie)
|
7
|
+
set_cookie.split(',').map { |full| full.split(';').first.strip }.join('; ')
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_header(datum, header)
|
11
|
+
_, header_value = datum[:response][:headers].detect do |key, _|
|
12
|
+
key.casecmp(header) == 0
|
13
|
+
end
|
14
|
+
header_value
|
15
|
+
end
|
16
|
+
|
17
|
+
def response_call(datum)
|
18
|
+
cookie = get_header(datum, 'Set-Cookie')
|
19
|
+
if cookie
|
20
|
+
cookie = extract_cookies_from_set_cookie(cookie)
|
21
|
+
unless datum[:headers].key?("Cookie")
|
22
|
+
datum[:headers]["Cookie"] = cookie
|
23
|
+
else
|
24
|
+
original_cookies = datum[:headers]["Cookie"]
|
25
|
+
datum[:headers]["Cookie"] = original_cookies.empty? ? cookie : [original_cookies,cookie].join('; ')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
super(datum)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|