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,140 @@
|
|
1
|
+
* Aaron Stone <aaron@serendipity.cx>
|
2
|
+
* Adam Esterline <adam@esterlines.com>
|
3
|
+
* Alexander Sandström <alexander@skovik.com>
|
4
|
+
* Andrew Katz <andrew.katz@outright.com>
|
5
|
+
* Andy Delcambre <adelcambre@gmail.com>
|
6
|
+
* Anshul Khandelwal <anshul@anshulkhandelwal.com>
|
7
|
+
* Ash Wilson <smashwilson@gmail.com>
|
8
|
+
* Ben Burkert <ben@benburkert.com>
|
9
|
+
* Benedikt Böhm <bb@xnull.de>
|
10
|
+
* Bo Jeanes <me@bjeanes.com>
|
11
|
+
* Brandur <brandur@mutelight.org>
|
12
|
+
* Brian D. Burns <iosctr@gmail.com>
|
13
|
+
* Brian Hartsock <brian.hartsock@gmail.com>
|
14
|
+
* Bryan Paxton <starbelly@pobox.com>
|
15
|
+
* Caio Chassot <dev@caiochassot.com>
|
16
|
+
* Caius Durling <dev@caius.name>
|
17
|
+
* Carl Hörberg <carl.hoerberg@gmail.com>
|
18
|
+
* Carl Hörberg <carl.hoerberg@gmail.com>
|
19
|
+
* Carlos Sanchez <csanchez@maestrodev.com>
|
20
|
+
* Casper Thomsen <ct@clearhaus.com>
|
21
|
+
* Chris Hanks <christopher.m.hanks@gmail.com>
|
22
|
+
* Claudio Poli <masterkain@gmail.com>
|
23
|
+
* Damien Mathieu <damien@heroku.com>
|
24
|
+
* Dan Hensgen <dan@methodhead.com>
|
25
|
+
* Dan Peterson <dpiddy@gmail.com>
|
26
|
+
* Dan Prince <dprince@redhat.com>
|
27
|
+
* Dane Harrigan <dane.harrigan@gmail.com>
|
28
|
+
* Dave Myron <therealdave.myron@gmail.com>
|
29
|
+
* Dave Newton <davelnewton@gmail.com>
|
30
|
+
* David Biehl <dbiehl@ncmedical.com>
|
31
|
+
* David Biehl <lazylodr@gmail.com>
|
32
|
+
* Dimitrij Denissenko <dimitrij@blacksquaremedia.com>
|
33
|
+
* Dominik Richter <dominik.richter@gmail.com>
|
34
|
+
* Doug McInnes <doug@dougmcinnes.com>
|
35
|
+
* Eugene Howe <eugene@xtreme-computers.net>
|
36
|
+
* Evan Phoenix <evan@fallingsnow.net>
|
37
|
+
* Fabian Wiesel <fabian.wiesel@sap.com>
|
38
|
+
* Federico Ravasio <ravasio.federico@gmail.com>
|
39
|
+
* Glenn Pratt <glennpratt@gmail.com>
|
40
|
+
* Graeme Nelson <graeme.nelson@gmail.com>
|
41
|
+
* Guillaume Balaine <igosuki@gmail.com>
|
42
|
+
* Hakan Ensari <hakan.ensari@papercavalier.com>
|
43
|
+
* Ian Neubert <ian@ianneubert.com>
|
44
|
+
* Jacob Atzen <jacob@incremental.dk>
|
45
|
+
* James Cox <james@imaj.es>
|
46
|
+
* James Watling <watling.james@gmail.com>
|
47
|
+
* Jean Mertz <jean@mertz.fm>
|
48
|
+
* Jeremy Hinegardner <jeremy@copiousfreetime.org>
|
49
|
+
* Jesse Kempf <jesse.kempf@opower.com>
|
50
|
+
* Joe Rafaniello <jrafanie@redhat.com>
|
51
|
+
* John Keiser <jkeiser@opscode.com>
|
52
|
+
* John Leach <john@brightbox.co.uk>
|
53
|
+
* Jonas Pfenniger <jonas@pfenniger.name>
|
54
|
+
* Jonathan Dance <github@wuputah.com>
|
55
|
+
* Jonathan Dance <jd@wuputah.com>
|
56
|
+
* Jonathan Roes <jroes@jroes.net>
|
57
|
+
* Joshua B. Smith <jbsmith@us.ibm.com>
|
58
|
+
* Joshua Gross <joshua@surfeasy.com>
|
59
|
+
* Joshua Mckinney <joshmckin@gmail.com>
|
60
|
+
* Joshua Napoli <jnapoli@swipely-napoli.home>
|
61
|
+
* Joshua Napoli <jnapoli@swipely-napoli.local>
|
62
|
+
* Kelly Mahan <kmahan@kmahan.com>
|
63
|
+
* Kensuke Nagae <kyanny@gmail.com>
|
64
|
+
* Konstantin Shabanov <etehtsea@gmail.com>
|
65
|
+
* Kyle Rames <kyle.rames@rackspace.com>
|
66
|
+
* Lewis Marshall <lewis@lmars.net>
|
67
|
+
* Lincoln Stoll <me@lstoll.net>
|
68
|
+
* Louis Sobel <sobel@mit.edu>
|
69
|
+
* Mahemoff <michael@mahemoff.com>
|
70
|
+
* Mathias Meyer <meyer@paperplanes.de>
|
71
|
+
* Matt Gauger <matt.gauger@gmail.com>
|
72
|
+
* Matt Sanders <matt@modal.org>
|
73
|
+
* Matt Sanders <matt@polycot.com>
|
74
|
+
* Matt Snyder <snyder2112@me.com>
|
75
|
+
* Matt Todd <chiology@gmail.com>
|
76
|
+
* Max Lincoln <max@devopsy.com>
|
77
|
+
* Michael Brodhead <mkb@engineyard.com>
|
78
|
+
* Michael Hale <mike@hales.ws>
|
79
|
+
* Michael Rowe <mrowe@mojain.com>
|
80
|
+
* Michael Rykov <mrykov@gmail.com>
|
81
|
+
* Mike Heffner <mikeh@fesnel.com>
|
82
|
+
* Myron Marston <myron.marston@gmail.com>
|
83
|
+
* Nathan Long <nathan.long@tma1.com>
|
84
|
+
* Nathan Sutton <nate@zencoder.com>
|
85
|
+
* Nick Osborn <nick.osborn@digital.cabinet-office.gov.uk>
|
86
|
+
* Nicolas Sanguinetti <contacto@nicolassanguinetti.info>
|
87
|
+
* Paul Gideon Dann <pdgiddie@gmail.com>
|
88
|
+
* Pavel <pavel.evst@gmail.com>
|
89
|
+
* Peter Meier <peter.meier@immerda.ch>
|
90
|
+
* Peter Weldon <peter.weldon@null.net>
|
91
|
+
* Peter Weldon <peter@lautus.net>
|
92
|
+
* Phil Ross <phil.ross@gmail.com>
|
93
|
+
* Richard Ramsden <richard@rramsden.ca>
|
94
|
+
* Ruslan Korolev <rs3@fastmail.com>
|
95
|
+
* Ruslan Korolev <rs41@gmx.com>
|
96
|
+
* Ruslan Kyrychuk <ruslan.kyrychuk@gmail.com>
|
97
|
+
* Ryan Bigg <radarlistener@fastmail.fm>
|
98
|
+
* Ryan Mohr <ryan.mohr@gmail.com>
|
99
|
+
* Sam Withrow <sam.withrow@curiousnation.org>
|
100
|
+
* Scott Gonyea <me@aitrus.org>
|
101
|
+
* Scott Gonyea <me@sgonyea.com>
|
102
|
+
* Scott Walkinshaw <scott.walkinshaw@gmail.com>
|
103
|
+
* Sean Cribbs <seancribbs@gmail.com>
|
104
|
+
* Sergio Rubio <rubiojr@frameos.org>
|
105
|
+
* Shai Rosenfeld <shaiguitar@gmail.com>
|
106
|
+
* Stefan Merettig <stefan-merettig@nuriaproject.org>
|
107
|
+
* Stephen Chu <github@stephenchu.com>
|
108
|
+
* Swanand Pagnis <swanandp@users.noreply.github.com>
|
109
|
+
* Terry Howe <terrylhowe@gmail.com>
|
110
|
+
* Thom Mahoney & Josh Lane <tmahoney@engineyard.com>
|
111
|
+
* Thom May <thom@digital-science.com>
|
112
|
+
* Tim Carey-Smith <tim@spork.in>
|
113
|
+
* Todd Lunter <tlunter@gmail.com>
|
114
|
+
* Tom Maher <tmaher@heroku.com>
|
115
|
+
* Tom Maher <tmaher@tursom.org>
|
116
|
+
* Trym Skaar <trym@tryms.no>
|
117
|
+
* Tuomas Silen <tuomas.silen@nodeta.fi>
|
118
|
+
* Victor Costan <costan@gmail.com>
|
119
|
+
* Viven <vivien.schilis@gmail.com>
|
120
|
+
* Wesley Beary <geemus+github@gmail.com>
|
121
|
+
* Wesley Beary <geemus@engineyard.com>
|
122
|
+
* Wesley Beary <geemus@gmail.com>
|
123
|
+
* Wesley Beary <wbeary@engineyard.com>
|
124
|
+
* Wesley Beary <wesley@heroku.com>
|
125
|
+
* Zach Anker <zanker@squareup.com>
|
126
|
+
* chrisrhoden <carhoden@gmail.com>
|
127
|
+
* dickeyxxx <jeff@dickeyxxx.com>
|
128
|
+
* geemus (Wesley Beary) <wbeary@engineyard.com>
|
129
|
+
* geemus <geemus@gmail.com>
|
130
|
+
* ggoodale <ggoodale@gmail.com>
|
131
|
+
* marios <marios@redhat.com>
|
132
|
+
* mkb <mkb@black-ice.org>
|
133
|
+
* phiggins <pete@peterhiggins.org>
|
134
|
+
* rin_ne <rinrin.ne@gmail.com>
|
135
|
+
* rinrinne <rinrin.ne@gmail.com>
|
136
|
+
* rkyrychuk <ruslan.kyrychuk@gmail.com>
|
137
|
+
* sshaw <skye.shaw@gmail.com>
|
138
|
+
* starbelly <starbelly@pobox.com>
|
139
|
+
* twrodriguez <tw.rodriguez@gmail.com>
|
140
|
+
* zimbatm <zimbatm@zimbatm.com>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2009-2019 [CONTRIBUTORS.md](https://github.com/excon/excon/blob/master/CONTRIBUTORS.md)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,492 @@
|
|
1
|
+
# excon
|
2
|
+
|
3
|
+
Usable, fast, simple Ruby HTTP 1.1
|
4
|
+
|
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
|
+
|
7
|
+
[![Build Status](https://github.com/excon/excon/actions/workflows/ruby.yml/badge.svg)](https://github.com/excon/excon/actions/workflows/ruby.yml)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/excon.svg)](https://badge.fury.io/rb/excon)
|
9
|
+
|
10
|
+
* [Getting Started](#getting-started)
|
11
|
+
* [Options](#options)
|
12
|
+
* [Chunked Requests](#chunked-requests)
|
13
|
+
* [Pipelining Requests](#pipelining-requests)
|
14
|
+
* [Streaming Responses](#streaming-responses)
|
15
|
+
* [Proxy Support](#proxy-support)
|
16
|
+
* [Reusable ports](#reusable-ports)
|
17
|
+
* [Unix Socket Support](#unix-socket-support)
|
18
|
+
* [Stubs](#stubs)
|
19
|
+
* [Instrumentation](#instrumentation)
|
20
|
+
* [HTTPS client certificate](#https-client-certificate)
|
21
|
+
* [HTTPS/SSL Issues](#httpsssl-issues)
|
22
|
+
* [Getting Help](#getting-help)
|
23
|
+
* [Contributing](#contributing)
|
24
|
+
* [Plugins and Middlewares](#plugins-and-middlewares)
|
25
|
+
* [License](#license)
|
26
|
+
|
27
|
+
## Getting Started
|
28
|
+
|
29
|
+
Install the gem.
|
30
|
+
|
31
|
+
```
|
32
|
+
$ sudo gem install excon
|
33
|
+
```
|
34
|
+
|
35
|
+
Require with rubygems.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
require 'rubygems'
|
39
|
+
require 'excon'
|
40
|
+
```
|
41
|
+
|
42
|
+
The easiest way to get started is by using one-off requests. Supported one-off request methods are `connect`, `delete`, `get`, `head`, `options`, `post`, `put`, and `trace`. Requests return a response object which has `body`, `headers`, `remote_ip` and `status` attributes.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
response = Excon.get('http://geemus.com')
|
46
|
+
response.body # => "..."
|
47
|
+
response.headers # => {...}
|
48
|
+
response.remote_ip # => "..."
|
49
|
+
response.status # => 200
|
50
|
+
```
|
51
|
+
|
52
|
+
For API clients or other ongoing usage, reuse a connection across multiple requests to share options and improve performance.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
connection = Excon.new('http://geemus.com')
|
56
|
+
get_response = connection.get
|
57
|
+
post_response = connection.post(:path => '/foo')
|
58
|
+
delete_response = connection.delete(:path => '/bar')
|
59
|
+
```
|
60
|
+
|
61
|
+
By default, each connection is non-persistent. This means that each request made against a connection behaves like a
|
62
|
+
one-off request. Each request will establish a socket connection to the server, then close the socket once the request
|
63
|
+
is complete.
|
64
|
+
|
65
|
+
To use a persistent connection, use the `:persistent` option:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
connection = Excon.new('http://geemus.com', :persistent => true)
|
69
|
+
```
|
70
|
+
|
71
|
+
The initial request will establish a socket connection to the server and leave the socket open. Subsequent requests
|
72
|
+
will reuse that socket. You may call `Connection#reset` at any time to close the underlying socket, and the next request
|
73
|
+
will establish a new socket connection.
|
74
|
+
|
75
|
+
You may also control persistence on a per-request basis by setting the `:persistent` option for each request.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
connection = Excon.new('http://geemus.com') # non-persistent by default
|
79
|
+
connection.get # socket established, then closed
|
80
|
+
connection.get(:persistent => true) # socket established, left open
|
81
|
+
connection.get(:persistent => true) # socket reused
|
82
|
+
connection.get # socket reused, then closed
|
83
|
+
|
84
|
+
connection = Excon.new('http://geemus.com', :persistent => true)
|
85
|
+
connection.get # socket established, left open
|
86
|
+
connection.get(:persistent => false) # socket reused, then closed
|
87
|
+
connection.get(:persistent => false) # socket established, then closed
|
88
|
+
connection.get # socket established, left open
|
89
|
+
connection.get # socket reused
|
90
|
+
```
|
91
|
+
|
92
|
+
Note that sending a request with `:persistent => false` to close the socket will also send `Connection: close` to inform
|
93
|
+
the server the connection is no longer needed. `Connection#reset` will simply close our end of the socket.
|
94
|
+
|
95
|
+
|
96
|
+
## Options
|
97
|
+
|
98
|
+
Both one-off and persistent connections support many other options. The final options for a request are built up by starting with `Excon.defaults`, then merging in options from the connection and finally merging in any request options. In this way you have plenty of options on where and how to set options and can easily setup connections or defaults to match common options for a particular endpoint.
|
99
|
+
|
100
|
+
Here are a few common examples:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
# Output debug info, similar to ENV['EXCON_DEBUG']
|
104
|
+
connection = Excon.new('http://geemus.com/', :debug_request => true, :debug_response => true)
|
105
|
+
|
106
|
+
# Custom headers
|
107
|
+
Excon.get('http://geemus.com', :headers => {'Authorization' => 'Basic 0123456789ABCDEF'})
|
108
|
+
connection.get(:headers => {'Authorization' => 'Basic 0123456789ABCDEF'})
|
109
|
+
|
110
|
+
# Changing query strings
|
111
|
+
connection = Excon.new('http://geemus.com/')
|
112
|
+
connection.get(:query => {:foo => 'bar'})
|
113
|
+
|
114
|
+
# POST body encoded with application/x-www-form-urlencoded
|
115
|
+
Excon.post('http://geemus.com',
|
116
|
+
:body => 'language=ruby&class=fog',
|
117
|
+
:headers => { "Content-Type" => "application/x-www-form-urlencoded" })
|
118
|
+
|
119
|
+
# same again, but using URI to build the body of parameters
|
120
|
+
Excon.post('http://geemus.com',
|
121
|
+
:body => URI.encode_www_form(:language => 'ruby', :class => 'fog'),
|
122
|
+
:headers => { "Content-Type" => "application/x-www-form-urlencoded" })
|
123
|
+
|
124
|
+
# request takes a method option, accepting either a symbol or string
|
125
|
+
connection.request(:method => :get)
|
126
|
+
connection.request(:method => 'GET')
|
127
|
+
|
128
|
+
# expect one or more status codes, or raise an error
|
129
|
+
connection.request(:expects => [200, 201], :method => :get)
|
130
|
+
|
131
|
+
# this request can be repeated safely, so retry on errors up to 4 times
|
132
|
+
connection.request(:idempotent => true)
|
133
|
+
|
134
|
+
# this request can be repeated safely, retry up to 6 times
|
135
|
+
connection.request(:idempotent => true, :retry_limit => 6)
|
136
|
+
|
137
|
+
# this request can be repeated safely, retry up to 6 times and sleep 5 seconds
|
138
|
+
# in between each retry
|
139
|
+
connection.request(:idempotent => true, :retry_limit => 6, :retry_interval => 5)
|
140
|
+
|
141
|
+
# set longer read_timeout (default is 60 seconds)
|
142
|
+
connection.request(:read_timeout => 360)
|
143
|
+
|
144
|
+
# set longer write_timeout (default is 60 seconds)
|
145
|
+
connection.request(:write_timeout => 360)
|
146
|
+
|
147
|
+
# Enable the socket option TCP_NODELAY on the underlying socket.
|
148
|
+
#
|
149
|
+
# This can improve response time when sending frequent short
|
150
|
+
# requests in time-sensitive scenarios.
|
151
|
+
#
|
152
|
+
connection = Excon.new('http://geemus.com/', :tcp_nodelay => true)
|
153
|
+
|
154
|
+
# set longer connect_timeout (default is 60 seconds)
|
155
|
+
connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
|
156
|
+
|
157
|
+
# opt-out of nonblocking operations for performance and/or as a workaround
|
158
|
+
connection = Excon.new('http://geemus.com/', :nonblock => false)
|
159
|
+
|
160
|
+
# use basic authentication by supplying credentials in the URL or as parameters
|
161
|
+
connection = Excon.new('http://username:password@secure.geemus.com')
|
162
|
+
# Note: username & password is unescaped for request, so you should provide escaped values here
|
163
|
+
# i. e. instead of `password: 'pa%%word'` you should use `password: Excon::Utils.escape_uri('pa%%word')`,
|
164
|
+
# which return `pa%25%25word`
|
165
|
+
connection = Excon.new('http://secure.geemus.com',
|
166
|
+
:user => 'username', :password => 'password')
|
167
|
+
|
168
|
+
# use custom uri parser
|
169
|
+
require 'addressable/uri'
|
170
|
+
connection = Excon.new('http://geemus.com/', uri_parser: Addressable::URI)
|
171
|
+
```
|
172
|
+
|
173
|
+
Compared to web browsers and other http client libraries, e.g. curl, Excon is a bit more low-level and doesn't assume much by default. If you are seeing different results compared to other clients, the following options might help:
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
# opt-in to omitting port from http:80 and https:443
|
177
|
+
connection = Excon.new('http://geemus.com/', :omit_default_port => true)
|
178
|
+
|
179
|
+
# accept gzip encoding
|
180
|
+
connection = Excon.new('http://geemus.com/', :headers => { "Accept-Encoding" => "gzip" })
|
181
|
+
|
182
|
+
# turn off peer verification (less secure)
|
183
|
+
Excon.defaults[:ssl_verify_peer] = false
|
184
|
+
connection = Excon.new('https://...')
|
185
|
+
```
|
186
|
+
|
187
|
+
## Chunked Requests
|
188
|
+
|
189
|
+
You can make `Transfer-Encoding: chunked` requests by passing a block that will deliver chunks, delivering an empty chunk to signal completion.
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
file = File.open('data')
|
193
|
+
|
194
|
+
chunker = lambda do
|
195
|
+
# Excon.defaults[:chunk_size] defaults to 1048576, ie 1MB
|
196
|
+
# to_s will convert the nil received after everything is read to the final empty chunk
|
197
|
+
file.read(Excon.defaults[:chunk_size]).to_s
|
198
|
+
end
|
199
|
+
|
200
|
+
Excon.post('http://geemus.com', :request_block => chunker)
|
201
|
+
|
202
|
+
file.close
|
203
|
+
```
|
204
|
+
|
205
|
+
Iterating in this way allows you to have more granular control over writes and to write things where you can not calculate the overall length up front.
|
206
|
+
|
207
|
+
## Pipelining Requests
|
208
|
+
|
209
|
+
You can make use of HTTP pipelining to improve performance. Instead of the normal request/response cycle, pipelining sends a series of requests and then receives a series of responses. You can take advantage of this using the `requests` method, which takes an array of params where each is a hash like request would receive and returns an array of responses.
|
210
|
+
|
211
|
+
```ruby
|
212
|
+
connection = Excon.new('http://geemus.com/')
|
213
|
+
connection.requests([{:method => :get}, {:method => :get}])
|
214
|
+
```
|
215
|
+
|
216
|
+
By default, each call to `requests` will use a separate persistent socket connection. To make multiple `requests` calls
|
217
|
+
using a single persistent connection, set `:persistent => true` when establishing the connection.
|
218
|
+
|
219
|
+
For large numbers of simultaneous requests please consider using the `batch_requests` method. This will automatically slice up the requests into batches based on the file descriptor limit of your operating system. The results are the same as the `requests` method, but using this method can help prevent timeout errors.
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
large_array_of_requests = [{:method => :get, :path => 'some_path'}, { ... }] # Hundreds of items
|
223
|
+
connection.batch_requests(large_array_of_requests)
|
224
|
+
```
|
225
|
+
|
226
|
+
## Streaming Responses
|
227
|
+
|
228
|
+
You can stream responses by passing a block that will receive each chunk.
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
streamer = lambda do |chunk, remaining_bytes, total_bytes|
|
232
|
+
puts chunk
|
233
|
+
puts "Remaining: #{remaining_bytes.to_f / total_bytes}%"
|
234
|
+
end
|
235
|
+
|
236
|
+
Excon.get('http://geemus.com', :response_block => streamer)
|
237
|
+
```
|
238
|
+
|
239
|
+
Iterating over each chunk will allow you to do work on the response incrementally without buffering the entire response first. For very large responses this can lead to significant memory savings.
|
240
|
+
|
241
|
+
## Proxy Support
|
242
|
+
|
243
|
+
You can specify a proxy URL that Excon will use with both HTTP and HTTPS connections:
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
connection = Excon.new('http://geemus.com', :proxy => 'http://my.proxy:3128')
|
247
|
+
connection.request(:method => 'GET')
|
248
|
+
|
249
|
+
Excon.get('http://geemus.com', :proxy => 'http://my.proxy:3128')
|
250
|
+
```
|
251
|
+
|
252
|
+
The proxy URL must be fully specified, including scheme (e.g. "http://") and port.
|
253
|
+
|
254
|
+
Proxy support must be set when establishing a connection object and cannot be overridden in individual requests.
|
255
|
+
|
256
|
+
NOTE: Excon will use `HTTP_PROXY` and `HTTPS_PROXY` environment variables. If set they will take precedence over any :proxy option specified in code. If "HTTPS_PROXY" is not set, "HTTP_PROXY" will be used for both HTTP and HTTPS connections. To disable this behavior, set the `NO_PROXY` environment variable and other environment variable proxy settings will be disregarded.
|
257
|
+
|
258
|
+
## Reusable ports
|
259
|
+
|
260
|
+
For advanced cases where you'd like to reuse the local port assigned to the excon socket in another socket, use the `:reuseaddr` option.
|
261
|
+
|
262
|
+
```ruby
|
263
|
+
connection = Excon.new('http://geemus.com', :reuseaddr => true)
|
264
|
+
connection.get
|
265
|
+
|
266
|
+
s = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
|
267
|
+
s.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)
|
268
|
+
if defined?(Socket::SO_REUSEPORT)
|
269
|
+
s.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEPORT, true)
|
270
|
+
end
|
271
|
+
|
272
|
+
s.bind(Socket.pack_sockaddr_in(connection.local_port, connection.local_address))
|
273
|
+
s.connect(Socket.pack_sockaddr_in(80, '1.2.3.4'))
|
274
|
+
puts s.read
|
275
|
+
s.close
|
276
|
+
```
|
277
|
+
|
278
|
+
## Unix Socket Support
|
279
|
+
|
280
|
+
The Unix socket will work for one-off requests and multiuse connections. A Unix socket path must be provided separate from the resource path.
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
connection = Excon.new('unix:///', :socket => '/tmp/unicorn.sock')
|
284
|
+
connection.request(:method => :get, :path => '/ping')
|
285
|
+
|
286
|
+
Excon.get('unix:///ping', :socket => '/tmp/unicorn.sock')
|
287
|
+
```
|
288
|
+
|
289
|
+
NOTE: Proxies will be ignored when using a Unix socket, since a Unix socket has to be local.
|
290
|
+
|
291
|
+
## Stubs
|
292
|
+
|
293
|
+
You can stub out requests for testing purposes by enabling mock mode on a connection.
|
294
|
+
|
295
|
+
```ruby
|
296
|
+
connection = Excon.new('http://example.com', :mock => true)
|
297
|
+
```
|
298
|
+
|
299
|
+
Or by enabling mock mode for a request.
|
300
|
+
|
301
|
+
```ruby
|
302
|
+
connection.request(:method => :get, :path => 'example', :mock => true)
|
303
|
+
```
|
304
|
+
|
305
|
+
Add stubs by providing the request attributes to match and response attributes to return. Response params can be specified as either a hash or block which will yield with the request params.
|
306
|
+
|
307
|
+
```ruby
|
308
|
+
Excon.stub({}, {:body => 'body', :status => 200})
|
309
|
+
Excon.stub({}, lambda {|request_params| {:body => request_params[:body], :status => 200}})
|
310
|
+
```
|
311
|
+
|
312
|
+
Omitted attributes are assumed to match, so this stub will match *any* request and return an Excon::Response with a body of 'body' and status of 200. You can add whatever stubs you might like this way and they will be checked against in the order they were added, if none of them match then excon will raise an `Excon::Errors::StubNotFound` error to let you know.
|
313
|
+
|
314
|
+
If you want to allow unstubbed requests without raising `StubNotFound`, set the `allow_unstubbed_requests` option either globally or per request.
|
315
|
+
|
316
|
+
```ruby
|
317
|
+
connection = Excon.new('http://example.com', :mock => true, :allow_unstubbed_requests => true)
|
318
|
+
```
|
319
|
+
|
320
|
+
To remove a previously defined stub, or all stubs:
|
321
|
+
|
322
|
+
```ruby
|
323
|
+
Excon.unstub({}) # remove first/oldest stub matching {}
|
324
|
+
Excon.stubs.clear # remove all stubs
|
325
|
+
```
|
326
|
+
|
327
|
+
For example, if using RSpec for your test suite you can clear stubs after running each example:
|
328
|
+
|
329
|
+
```ruby
|
330
|
+
config.after(:each) do
|
331
|
+
Excon.stubs.clear
|
332
|
+
end
|
333
|
+
```
|
334
|
+
|
335
|
+
You can also modify `Excon.defaults` to set a stub for all requests, so for a test suite you might do this:
|
336
|
+
|
337
|
+
```ruby
|
338
|
+
# Mock by default and stub any request as success
|
339
|
+
config.before(:all) do
|
340
|
+
Excon.defaults[:mock] = true
|
341
|
+
Excon.stub({}, {:body => 'Fallback', :status => 200})
|
342
|
+
# Add your own stubs here or in specific tests...
|
343
|
+
end
|
344
|
+
```
|
345
|
+
|
346
|
+
By default stubs are shared globally, to make stubs unique to each thread, use `Excon.defaults[:stubs] = :local`.
|
347
|
+
|
348
|
+
## Instrumentation
|
349
|
+
|
350
|
+
Excon calls can be timed using the [ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) API.
|
351
|
+
|
352
|
+
```ruby
|
353
|
+
connection = Excon.new(
|
354
|
+
'http://geemus.com',
|
355
|
+
:instrumentor => ActiveSupport::Notifications
|
356
|
+
)
|
357
|
+
```
|
358
|
+
|
359
|
+
Excon will then instrument each request, retry, and error. The corresponding events are named `excon.request`, `excon.retry`, and `excon.error` respectively.
|
360
|
+
|
361
|
+
```ruby
|
362
|
+
ActiveSupport::Notifications.subscribe(/excon/) do |*args|
|
363
|
+
puts "Excon did stuff!"
|
364
|
+
end
|
365
|
+
```
|
366
|
+
|
367
|
+
If you prefer to label each event with a namespace other than "excon", you may specify
|
368
|
+
an alternate name in the constructor:
|
369
|
+
|
370
|
+
```ruby
|
371
|
+
connection = Excon.new(
|
372
|
+
'http://geemus.com',
|
373
|
+
:instrumentor => ActiveSupport::Notifications,
|
374
|
+
:instrumentor_name => 'my_app'
|
375
|
+
)
|
376
|
+
```
|
377
|
+
|
378
|
+
Note: Excon's ActiveSupport::Notifications implementation has the following event format: `<namespace>.<event>` which is the opposite of the Rails' implementation.
|
379
|
+
|
380
|
+
ActiveSupport provides a [subscriber](http://api.rubyonrails.org/classes/ActiveSupport/Subscriber.html) interface which lets you attach a subscriber to a namespace. Due to the incompability above, you won't be able to attach a subscriber to the "excon" namespace out of the box.
|
381
|
+
|
382
|
+
If you want this functionality, you can use a simple adapter such as this one:
|
383
|
+
|
384
|
+
```ruby
|
385
|
+
class ExconToRailsInstrumentor
|
386
|
+
def self.instrument(name, datum, &block)
|
387
|
+
namespace, *event = name.split(".")
|
388
|
+
rails_name = [event, namespace].flatten.join(".")
|
389
|
+
ActiveSupport::Notifications.instrument(rails_name, datum, &block)
|
390
|
+
end
|
391
|
+
end
|
392
|
+
```
|
393
|
+
|
394
|
+
If you don't want to add ActiveSupport to your application, simply define a class which implements the same `#instrument` method like so:
|
395
|
+
|
396
|
+
```ruby
|
397
|
+
class SimpleInstrumentor
|
398
|
+
class << self
|
399
|
+
attr_accessor :events
|
400
|
+
|
401
|
+
def instrument(name, params = {}, &block)
|
402
|
+
puts "#{name} just happened."
|
403
|
+
yield if block_given?
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
```
|
408
|
+
|
409
|
+
The #instrument method will be called for each HTTP request, response, retry, and error.
|
410
|
+
|
411
|
+
For debugging purposes you can also use `Excon::StandardInstrumentor` to output all events to stderr. This can also be specified by setting the `EXCON_DEBUG` ENV var.
|
412
|
+
|
413
|
+
See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's [instrumentation_test.rb](https://github.com/excon/excon/blob/master/tests/middlewares/instrumentation_tests.rb) for more examples of instrumenting excon.
|
414
|
+
|
415
|
+
## HTTPS client certificate
|
416
|
+
|
417
|
+
You can supply a client side certificate if the server requires it for authentication:
|
418
|
+
|
419
|
+
```ruby
|
420
|
+
connection = Excon.new('https://example.com',
|
421
|
+
client_cert: 'mycert.pem',
|
422
|
+
client_key: 'mycert.key',
|
423
|
+
client_key_pass: 'my pass phrase')
|
424
|
+
```
|
425
|
+
|
426
|
+
`client_key_pass` is optional.
|
427
|
+
|
428
|
+
If you already have loaded the certificate and key into memory, then pass it through like:
|
429
|
+
|
430
|
+
```ruby
|
431
|
+
client_cert_data = File.load 'mycert.pem'
|
432
|
+
client_key_data = File.load 'mycert.key'
|
433
|
+
|
434
|
+
connection = Excon.new('https://example.com',
|
435
|
+
client_cert_data: client_cert_data,
|
436
|
+
client_key_data: client_key_data)
|
437
|
+
```
|
438
|
+
|
439
|
+
This can be useful if your program has already loaded the assets through
|
440
|
+
another mechanism (E.g. a remote API call to a secure K:V system like Vault).
|
441
|
+
|
442
|
+
## HTTPS/SSL Issues
|
443
|
+
|
444
|
+
By default excon will try to verify peer certificates when using HTTPS. Unfortunately on some operating systems the defaults will not work. This will likely manifest itself as something like `Excon::Errors::CertificateError: SSL_connect returned=1 ...`
|
445
|
+
|
446
|
+
If you have the misfortune of running into this problem you have a couple options. If you have certificates but they aren't being auto-discovered, you can specify the path to your certificates:
|
447
|
+
|
448
|
+
```ruby
|
449
|
+
Excon.defaults[:ssl_ca_path] = '/path/to/certs'
|
450
|
+
```
|
451
|
+
|
452
|
+
Failing that, you can turn off peer verification (less secure):
|
453
|
+
|
454
|
+
```ruby
|
455
|
+
Excon.defaults[:ssl_verify_peer] = false
|
456
|
+
```
|
457
|
+
|
458
|
+
Either of these should allow you to work around the socket error and continue with your work.
|
459
|
+
|
460
|
+
## Getting Help
|
461
|
+
|
462
|
+
* Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/excon).
|
463
|
+
* Report bugs and discuss potential features in [Github issues](https://github.com/excon/excon/issues).
|
464
|
+
|
465
|
+
## Contributing
|
466
|
+
|
467
|
+
Please refer to [CONTRIBUTING.md](https://github.com/excon/excon/blob/master/CONTRIBUTING.md).
|
468
|
+
|
469
|
+
# Plugins and Middlewares
|
470
|
+
|
471
|
+
Using Excon's [Middleware system][middleware], you can easily extend Excon's
|
472
|
+
functionality with your own. The following plugins extend Excon in their own
|
473
|
+
way:
|
474
|
+
|
475
|
+
* [excon-addressable](https://github.com/JeanMertz/excon-addressable)
|
476
|
+
|
477
|
+
Set [addressable](https://github.com/sporkmonger/addressable) as the default
|
478
|
+
URI parser, and add support for [URI templating][templating].
|
479
|
+
|
480
|
+
* [excon-hypermedia](https://github.com/JeanMertz/excon-hypermedia)
|
481
|
+
|
482
|
+
Teaches Excon to talk with [HyperMedia APIs][hypermedia]. Allowing you to use
|
483
|
+
all of Excon's functionality, while traversing APIs in an easy and
|
484
|
+
self-discovering way.
|
485
|
+
|
486
|
+
## License
|
487
|
+
|
488
|
+
Please refer to [LICENSE.md](https://github.com/excon/excon/blob/master/LICENSE.md).
|
489
|
+
|
490
|
+
[middleware]: lib/excon/middlewares/base.rb
|
491
|
+
[hypermedia]: https://en.wikipedia.org/wiki/HATEOAS
|
492
|
+
[templating]: https://www.rfc-editor.org/rfc/rfc6570.txt
|