excon 0.92.4 → 0.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27d135a08d31acae6470830e52c2106edb009aa323e722b8b4f33f1e363ba751
4
- data.tar.gz: 39b76ea9456a60d7bde87139cca00d58da653cc4f518ae3ca65863e9fe8fdda3
3
+ metadata.gz: 02c669c6654fe1baab80a1a55bc0a2d2b40a64360f3d95d77ef79b59315f879a
4
+ data.tar.gz: '0759c4b45586f33258913b23ffb9b649cf40848816537f57763be8922ecc2b0b'
5
5
  SHA512:
6
- metadata.gz: 63cdd6010814edb1a94e7bc1c694e7dedb2cca7c51dee26fe89a7bd71fad1f2a803763d49ae0f6e8103c7114acc423e92d0c610620b97ae817a936b0990af484
7
- data.tar.gz: f759aa0467043e50c8af544c881fadab669505a7a62b58cc2a68dd7bf1be9a3e6db3656092e66618dd8161310d39deee1d841adf6ed0b8d02719574211d3d983
6
+ metadata.gz: 1d25f9b6551303983b04114bf9fa2d27e7a3ad06bcfa8cc2295fe8b8afd04142f103ce02d4969b7f06af5c10465c343921a12543dd348787a348b9ca150f30c9
7
+ data.tar.gz: 3db2e11eae51f277b7a22ab3daa2505ea836098f6789001e580354f29706e5b6f1cd063cbab772ac6811186f0a8af955dd26029a17b15ea5a5b79d14285ba7b6
data/CONTRIBUTORS.md CHANGED
@@ -1,140 +1,182 @@
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>
1
+ * Aaron Stone
2
+ * Adam Avilla
3
+ * Adam Esterline
4
+ * Alexander Sandström
5
+ * Alexandr Burov
6
+ * Andrew Katz
7
+ * Andrew Metcalf
8
+ * Andrew Sullivan Cant
9
+ * André Diego Piske
10
+ * Andy Delcambre
11
+ * Anshul Khandelwal
12
+ * Anton Chuchkalov
13
+ * Antonio Terceiro
14
+ * Ash Wilson
15
+ * Atul Bhosale
16
+ * Bart de Water
17
+ * Ben Burkert
18
+ * Benedikt Böhm
19
+ * Bill Mill
20
+ * Bo Jeanes
21
+ * Brandur
22
+ * Brian D. Burns
23
+ * Brian Hartsock
24
+ * Bryan Paxton
25
+ * Caio Chassot
26
+ * Caius Durling
27
+ * Carl Hörberg
28
+ * Carl Hörberg
29
+ * Carlos Sanchez
30
+ * Casper Thomsen
31
+ * Chris Hanks
32
+ * Christoph Rieß
33
+ * Christophe Taton
34
+ * Claudio Poli
35
+ * Craig Shannon
36
+ * Damien Mathieu
37
+ * Dan Hensgen
38
+ * Dan Peterson
39
+ * Dan Prince
40
+ * Dane Harrigan
41
+ * Daniel Berger
42
+ * Dave Myron
43
+ * Dave Newton
44
+ * Dave Vasilevsky
45
+ * David Biehl
46
+ * David Taylor
47
+ * Dimitrij Denissenko
48
+ * Dominik Richter
49
+ * Doug McInnes
50
+ * Esteban Pastorino
51
+ * Eugene Howe
52
+ * Evan Phoenix
53
+ * Fabian Wiesel
54
+ * Federico Ravasio
55
+ * Felix Wolfsteller
56
+ * Glenn Pratt
57
+ * Graeme Nelson
58
+ * Grey Baker
59
+ * Guillaume Balaine
60
+ * Hakan Ensari
61
+ * Hiroshi Hatake
62
+ * Ian Neubert
63
+ * Igor Fedoronchuk
64
+ * Jacob Atzen
65
+ * James Cox
66
+ * James Watling
67
+ * Jean Mertz
68
+ * Jeremy Hinegardner
69
+ * Jesse Kempf
70
+ * Jessica Jiang
71
+ * Joe Rafaniello
72
+ * John Keiser
73
+ * John Leach
74
+ * Jonas Pfenniger
75
+ * Jonathan Dance
76
+ * Jonathan Roes
77
+ * Joshua B. Smith
78
+ * Joshua Gross
79
+ * Joshua Mckinney
80
+ * Joshua Napoli
81
+ * Kelly Mahan
82
+ * Kensuke Nagae
83
+ * Kimmo Lehto
84
+ * Koen Rouwhorst
85
+ * Konstantin Shabanov
86
+ * Kyle Purkiss
87
+ * Kyle Rames
88
+ * Lewis Marshall
89
+ * Lincoln Stoll
90
+ * Louis Sobel
91
+ * Mahemoff
92
+ * Marco Costa
93
+ * Markus Bucher
94
+ * Mathias Meyer
95
+ * Matt Gauger
96
+ * Matt Palmer
97
+ * Matt Sanders
98
+ * Matt Snyder
99
+ * Matt Todd
100
+ * Maurice Schreiber
101
+ * Max Lincoln
102
+ * Michael Brodhead
103
+ * Michael Hale
104
+ * Michael Rowe
105
+ * Michael Rykov
106
+ * Mike Heffner
107
+ * Milovan Zogovic
108
+ * Myron Marston
109
+ * Nathan Long
110
+ * Nathan Sutton
111
+ * Nick Osborn
112
+ * Nicolas Leger
113
+ * Nicolas Sanguinetti
114
+ * Paul Gideon Dann
115
+ * Pavel
116
+ * Pavel Valena
117
+ * Peter Meier
118
+ * Peter Weldon
119
+ * Phil Ross
120
+ * Raul Murciano
121
+ * Richard Godbee
122
+ * Richard Ramsden
123
+ * Rohan Mendon
124
+ * Ruslan Korolev
125
+ * Ruslan Kyrychuk
126
+ * Ryan Bigg
127
+ * Ryan Mohr
128
+ * Ryan Schlesinger
129
+ * Ryoji Yoshioka
130
+ * Sam
131
+ * Sam Lehman
132
+ * Sam Withrow
133
+ * Scott Gonyea
134
+ * Scott Walkinshaw
135
+ * Sean Cribbs
136
+ * Sergio Rubio
137
+ * Shai Rosenfeld
138
+ * Stan Hu
139
+ * Stefan Merettig
140
+ * Stephen Chu
141
+ * Swanand Pagnis
142
+ * Terry Howe
143
+ * Thom Mahoney & Josh Lane
144
+ * Thom May
145
+ * Tim Carey-Smith
146
+ * Timothée Peignier
147
+ * Tobias Schmidt
148
+ * Todd Lunter
149
+ * Tom Maher
150
+ * Trym Skaar
151
+ * Tuomas Silen
152
+ * Victor Costan
153
+ * Viven
154
+ * Vít Ondruch
155
+ * Wesley Beary
156
+ * Yusuke Nakamura
157
+ * Zach Anker
158
+ * chrisrhoden
159
+ * dependabot[bot]
160
+ * dickeyxxx
161
+ * geemus
162
+ * geemus (Wesley Beary)
163
+ * ggoodale
164
+ * ivan.filenko
165
+ * jasquat
166
+ * karimb
167
+ * marios
168
+ * mkb
169
+ * nathannaveen
170
+ * ojab
171
+ * patrick brisbin
172
+ * pavel
173
+ * phiggins
174
+ * rin_ne
175
+ * rinrinne
176
+ * rkyrychuk
177
+ * shale
178
+ * sshaw
179
+ * starbelly
180
+ * twrodriguez
181
+ * wsnarski
182
+ * zimbatm
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/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)
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)
@@ -127,6 +127,38 @@ connection.request(:method => 'GET')
127
127
  # expect one or more status codes, or raise an error
128
128
  connection.request(:expects => [200, 201], :method => :get)
129
129
 
130
+ # use basic authentication by supplying credentials in the URL or as parameters
131
+ connection = Excon.new('http://username:password@secure.geemus.com')
132
+ # Note: username & password is unescaped for request, so you should provide escaped values here
133
+ # i. e. instead of `password: 'pa%%word'` you should use `password: Excon::Utils.escape_uri('pa%%word')`,
134
+ # which return `pa%25%25word`
135
+ connection = Excon.new('http://secure.geemus.com',
136
+ :user => 'username', :password => 'password')
137
+
138
+ # use custom uri parser
139
+ require 'addressable/uri'
140
+ connection = Excon.new('http://geemus.com/', uri_parser: Addressable::URI)
141
+ ```
142
+
143
+ 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:
144
+
145
+ ```ruby
146
+ # opt-in to omitting port from http:80 and https:443
147
+ connection = Excon.new('http://geemus.com/', :omit_default_port => true)
148
+
149
+ # accept gzip encoding
150
+ connection = Excon.new('http://geemus.com/', :headers => { "Accept-Encoding" => "gzip" })
151
+
152
+ # turn off peer verification (less secure)
153
+ Excon.defaults[:ssl_verify_peer] = false
154
+ connection = Excon.new('https://...')
155
+ ```
156
+
157
+ ## Timeouts and Retries
158
+
159
+ You can modify timeouts and define whether and how many (blocking) retries Excon should attempt if errors occur.
160
+
161
+ ```ruby
130
162
  # this request can be repeated safely, so retry on errors up to 4 times
131
163
  connection.request(:idempotent => true)
132
164
 
@@ -137,12 +169,20 @@ connection.request(:idempotent => true, :retry_limit => 6)
137
169
  # in between each retry
138
170
  connection.request(:idempotent => true, :retry_limit => 6, :retry_interval => 5)
139
171
 
172
+ # specify the errors on which to retry (default Timeout, Socket, HTTPStatus)
173
+ # only retry on timeouts
174
+ connection.request(:idempotent => true, :retry_limit => 6, :retry_interval => 5, :retry_errors => [Excon::Error::Timeout] )
175
+
140
176
  # set longer read_timeout (default is 60 seconds)
141
177
  connection.request(:read_timeout => 360)
142
178
 
143
179
  # set longer write_timeout (default is 60 seconds)
144
180
  connection.request(:write_timeout => 360)
145
181
 
182
+ # set a request timeout in seconds (default is no timeout).
183
+ # the timeout may be an integer or a float to support sub-second granularity (e.g., 1, 60, 0.005 and 3.5).
184
+ connection.request(:timeout => 0.1) # timeout if the entire request takes longer than 100 milliseconds
185
+
146
186
  # Enable the socket option TCP_NODELAY on the underlying socket.
147
187
  #
148
188
  # This can improve response time when sending frequent short
@@ -156,31 +196,20 @@ connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
156
196
  # opt-out of nonblocking operations for performance and/or as a workaround
157
197
  connection = Excon.new('http://geemus.com/', :nonblock => false)
158
198
 
159
- # use basic authentication by supplying credentials in the URL or as parameters
160
- connection = Excon.new('http://username:password@secure.geemus.com')
161
- # Note: username & password is unescaped for request, so you should provide escaped values here
162
- # i. e. instead of `password: 'pa%%word'` you should use `password: Excon::Utils.escape_uri('pa%%word')`,
163
- # which return `pa%25%25word`
164
- connection = Excon.new('http://secure.geemus.com',
165
- :user => 'username', :password => 'password')
199
+ # DEPRECATED in favour of `resolv_resolver` (see below)
200
+ # set up desired dns_timeouts for resolving addresses (default is set by Resolv)
201
+ # it accepts an integer or an array of integers for retrying with different timeouts
202
+ # see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
203
+ connection = Excon.new('http://geemus.com/', :dns_timeouts => 3)
166
204
 
167
- # use custom uri parser
168
- require 'addressable/uri'
169
- connection = Excon.new('http://geemus.com/', uri_parser: Addressable::URI)
170
- ```
171
-
172
- 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:
173
-
174
- ```ruby
175
- # opt-in to omitting port from http:80 and https:443
176
- connection = Excon.new('http://geemus.com/', :omit_default_port => true)
177
-
178
- # accept gzip encoding
179
- connection = Excon.new('http://geemus.com/', :headers => { "Accept-Encoding" => "gzip" })
180
-
181
- # turn off peer verification (less secure)
182
- Excon.defaults[:ssl_verify_peer] = false
183
- connection = Excon.new('https://...')
205
+ # set a custom resolver for Resolv
206
+ # you can use custom nameservers and timeouts
207
+ # `timeouts` accepts an integer or an array of integers for retrying with different timeouts
208
+ # see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
209
+ dns_resolver = Resolv::DNS.new(nameserver: ['127.0.0.1'])
210
+ dns_resolver.timeouts = 3
211
+ resolver = Resolv.new([Resolv::Hosts.new, dns_resolver])
212
+ connection = Excon.new('http://geemus.com', :resolv_resolver => resolver)
184
213
  ```
185
214
 
186
215
  ## Chunked Requests
@@ -436,7 +465,16 @@ connection = Excon.new('https://example.com',
436
465
 
437
466
  `client_key_pass` is optional.
438
467
 
439
- If you already have loaded the certificate and key into memory, then pass it through like:
468
+ Optionally, you can also pass the whole chain by passing the extra certificates through `client_chain`:
469
+
470
+ ```ruby
471
+ connection = Excon.new('https://example.com',
472
+ client_cert: 'mycert.pem',
473
+ client_chain: 'mychain.pem',
474
+ client_key: 'mycert.key')
475
+ ```
476
+
477
+ If you already have loaded the certificate, key and chain into memory, then pass it through like:
440
478
 
441
479
  ```ruby
442
480
  client_cert_data = File.load 'mycert.pem'
@@ -444,6 +482,7 @@ client_key_data = File.load 'mycert.key'
444
482
 
445
483
  connection = Excon.new('https://example.com',
446
484
  client_cert_data: client_cert_data,
485
+ client_chain_data: client_chain_data,
447
486
  client_key_data: client_key_data)
448
487
  ```
449
488