excon 0.49.0 → 0.58.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CONTRIBUTORS.md +33 -3
- data/Gemfile +3 -3
- data/Gemfile.lock +26 -10
- data/README.md +67 -5
- data/Rakefile +24 -1
- data/benchmarks/concat_vs_interpolate.rb +6 -5
- data/changelog.txt +107 -17
- data/data/cacert.pem +423 -361
- data/excon.gemspec +26 -6
- data/lib/excon/connection.rb +20 -20
- data/lib/excon/constants.rb +9 -4
- data/lib/excon/error.rb +214 -0
- data/lib/excon/extensions/uri.rb +1 -0
- data/lib/excon/headers.rb +1 -0
- data/lib/excon/middlewares/base.rb +1 -0
- data/lib/excon/middlewares/capture_cookies.rb +1 -0
- data/lib/excon/middlewares/decompress.rb +1 -0
- data/lib/excon/middlewares/escape_path.rb +1 -0
- data/lib/excon/middlewares/expects.rb +1 -0
- data/lib/excon/middlewares/idempotent.rb +4 -0
- data/lib/excon/middlewares/instrumentor.rb +1 -0
- data/lib/excon/middlewares/mock.rb +2 -1
- data/lib/excon/middlewares/redirect_follower.rb +1 -0
- data/lib/excon/middlewares/response_parser.rb +1 -0
- data/lib/excon/pretty_printer.rb +1 -0
- data/lib/excon/response.rb +4 -3
- data/lib/excon/socket.rb +5 -4
- data/lib/excon/ssl_socket.rb +43 -19
- data/lib/excon/standard_instrumentor.rb +1 -0
- data/lib/excon/test/plugin/server/exec.rb +23 -0
- data/lib/excon/test/plugin/server/puma.rb +20 -0
- data/lib/excon/test/plugin/server/unicorn.rb +35 -0
- data/lib/excon/test/plugin/server/webrick.rb +23 -0
- data/lib/excon/test/server.rb +106 -0
- data/lib/excon/unix_socket.rb +1 -0
- data/lib/excon/utils.rb +6 -5
- data/lib/excon.rb +7 -3
- data/spec/excon/error_spec.rb +139 -0
- data/spec/excon/test/server_spec.rb +28 -0
- data/spec/excon_spec.rb +7 -0
- data/spec/helpers/file_path_helpers.rb +22 -0
- data/spec/requests/basic_spec.rb +40 -0
- data/spec/requests/eof_requests_spec.rb +36 -0
- data/spec/requests/unix_socket_spec.rb +46 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/shared_contexts/test_server_context.rb +83 -0
- data/spec/support/shared_examples/shared_example_for_clients.rb +209 -0
- data/spec/support/shared_examples/shared_example_for_streaming_clients.rb +20 -0
- data/spec/support/shared_examples/shared_example_for_test_servers.rb +16 -0
- data/tests/authorization_header_tests.rb +0 -4
- data/tests/basic_tests.rb +23 -8
- data/tests/data/127.0.0.1.cert.crt +18 -12
- data/tests/data/127.0.0.1.cert.key +25 -13
- data/tests/data/excon.cert.crt +18 -12
- data/tests/data/excon.cert.key +25 -13
- data/tests/error_tests.rb +145 -0
- data/tests/middlewares/idempotent_tests.rb +33 -0
- data/tests/middlewares/instrumentation_tests.rb +5 -2
- data/tests/middlewares/mock_tests.rb +11 -0
- data/tests/test_helper.rb +2 -2
- metadata +52 -7
- data/lib/excon/errors.rb +0 -172
- data/tests/errors_tests.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5a871497c1ba80f94aff5ccd6f3f3955f1ba33e
|
4
|
+
data.tar.gz: 83bba479683ecfc6c5bc1917ea974ea2bf418af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da3e5359120096074eee8d261b8f8e74bdc6ccb0726410cad9e136166028153d540c89676cdfeefa72fb9595245d4f1de8f1a0b40891f2269780ae612caf6344
|
7
|
+
data.tar.gz: f38359c5408dc80744d7ccad319521fb81d96a4618b86411ed2db72be1d1a351c7ee3b8a8d3c4de92c38c769042a2e9de4300497b15f652c17ff9f521d85ca05
|
data/CONTRIBUTORS.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
* Aaron Stone <aaron@serendipity.cx>
|
2
|
+
* Adam Esterline <adam@esterlines.com>
|
3
|
+
* Alexander Sandström <alexander@skovik.com>
|
1
4
|
* Andrew Katz <andrew.katz@outright.com>
|
5
|
+
* Andy Delcambre <adelcambre@gmail.com>
|
2
6
|
* Anshul Khandelwal <anshul@anshulkhandelwal.com>
|
3
7
|
* Ash Wilson <smashwilson@gmail.com>
|
4
8
|
* Ben Burkert <ben@benburkert.com>
|
@@ -7,12 +11,15 @@
|
|
7
11
|
* Brandur <brandur@mutelight.org>
|
8
12
|
* Brian D. Burns <iosctr@gmail.com>
|
9
13
|
* Brian Hartsock <brian.hartsock@gmail.com>
|
14
|
+
* Bryan Paxton <starbelly@pobox.com>
|
10
15
|
* Caio Chassot <dev@caiochassot.com>
|
11
16
|
* Caius Durling <dev@caius.name>
|
12
17
|
* Carl Hörberg <carl.hoerberg@gmail.com>
|
18
|
+
* Carl Hörberg <carl.hoerberg@gmail.com>
|
13
19
|
* Carlos Sanchez <csanchez@maestrodev.com>
|
20
|
+
* Casper Thomsen <ct@clearhaus.com>
|
21
|
+
* Chris Hanks <christopher.m.hanks@gmail.com>
|
14
22
|
* Claudio Poli <masterkain@gmail.com>
|
15
|
-
* Colin Dean <colindean@us.ibm.com>
|
16
23
|
* Damien Mathieu <damien@heroku.com>
|
17
24
|
* Dan Hensgen <dan@methodhead.com>
|
18
25
|
* Dan Peterson <dpiddy@gmail.com>
|
@@ -24,35 +31,44 @@
|
|
24
31
|
* David Biehl <lazylodr@gmail.com>
|
25
32
|
* Dimitrij Denissenko <dimitrij@blacksquaremedia.com>
|
26
33
|
* Dominik Richter <dominik.richter@gmail.com>
|
34
|
+
* Doug McInnes <doug@dougmcinnes.com>
|
27
35
|
* Eugene Howe <eugene@xtreme-computers.net>
|
28
36
|
* Evan Phoenix <evan@fallingsnow.net>
|
29
37
|
* Fabian Wiesel <fabian.wiesel@sap.com>
|
30
38
|
* Federico Ravasio <ravasio.federico@gmail.com>
|
31
39
|
* Glenn Pratt <glennpratt@gmail.com>
|
32
40
|
* Graeme Nelson <graeme.nelson@gmail.com>
|
41
|
+
* Guillaume Balaine <igosuki@gmail.com>
|
33
42
|
* Hakan Ensari <hakan.ensari@papercavalier.com>
|
34
43
|
* Ian Neubert <ian@ianneubert.com>
|
35
44
|
* Jacob Atzen <jacob@incremental.dk>
|
45
|
+
* James Cox <james@imaj.es>
|
36
46
|
* James Watling <watling.james@gmail.com>
|
47
|
+
* Jean Mertz <jean@mertz.fm>
|
37
48
|
* Jeremy Hinegardner <jeremy@copiousfreetime.org>
|
49
|
+
* Jesse Kempf <jesse.kempf@opower.com>
|
50
|
+
* Joe Rafaniello <jrafanie@redhat.com>
|
38
51
|
* John Keiser <jkeiser@opscode.com>
|
39
52
|
* John Leach <john@brightbox.co.uk>
|
40
53
|
* Jonas Pfenniger <jonas@pfenniger.name>
|
41
54
|
* Jonathan Dance <github@wuputah.com>
|
42
55
|
* Jonathan Dance <jd@wuputah.com>
|
43
56
|
* Jonathan Roes <jroes@jroes.net>
|
57
|
+
* Joshua B. Smith <jbsmith@us.ibm.com>
|
44
58
|
* Joshua Gross <joshua@surfeasy.com>
|
45
59
|
* Joshua Mckinney <joshmckin@gmail.com>
|
46
60
|
* Joshua Napoli <jnapoli@swipely-napoli.home>
|
47
61
|
* Joshua Napoli <jnapoli@swipely-napoli.local>
|
48
|
-
*
|
62
|
+
* Kelly Mahan <kmahan@kmahan.com>
|
49
63
|
* Kensuke Nagae <kyanny@gmail.com>
|
50
64
|
* Konstantin Shabanov <etehtsea@gmail.com>
|
51
65
|
* Kyle Rames <kyle.rames@rackspace.com>
|
52
66
|
* Lewis Marshall <lewis@lmars.net>
|
53
67
|
* Lincoln Stoll <me@lstoll.net>
|
54
68
|
* Louis Sobel <sobel@mit.edu>
|
69
|
+
* Mahemoff <michael@mahemoff.com>
|
55
70
|
* Mathias Meyer <meyer@paperplanes.de>
|
71
|
+
* Matt Gauger <matt.gauger@gmail.com>
|
56
72
|
* Matt Sanders <matt@modal.org>
|
57
73
|
* Matt Sanders <matt@polycot.com>
|
58
74
|
* Matt Snyder <snyder2112@me.com>
|
@@ -68,16 +84,27 @@
|
|
68
84
|
* Nathan Sutton <nate@zencoder.com>
|
69
85
|
* Nick Osborn <nick.osborn@digital.cabinet-office.gov.uk>
|
70
86
|
* Nicolas Sanguinetti <contacto@nicolassanguinetti.info>
|
87
|
+
* Paul Gideon Dann <pdgiddie@gmail.com>
|
88
|
+
* Pavel <pavel.evst@gmail.com>
|
71
89
|
* Peter Meier <peter.meier@immerda.ch>
|
72
90
|
* Peter Weldon <peter.weldon@null.net>
|
73
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>
|
74
96
|
* Ruslan Kyrychuk <ruslan.kyrychuk@gmail.com>
|
97
|
+
* Ryan Bigg <radarlistener@fastmail.fm>
|
75
98
|
* Ryan Mohr <ryan.mohr@gmail.com>
|
99
|
+
* Sam Withrow <sam.withrow@curiousnation.org>
|
76
100
|
* Scott Gonyea <me@aitrus.org>
|
77
101
|
* Scott Gonyea <me@sgonyea.com>
|
102
|
+
* Scott Walkinshaw <scott.walkinshaw@gmail.com>
|
78
103
|
* Sean Cribbs <seancribbs@gmail.com>
|
79
104
|
* Sergio Rubio <rubiojr@frameos.org>
|
80
105
|
* Shai Rosenfeld <shaiguitar@gmail.com>
|
106
|
+
* Stefan Merettig <stefan-merettig@nuriaproject.org>
|
107
|
+
* Stephen Chu <github@stephenchu.com>
|
81
108
|
* Swanand Pagnis <swanandp@users.noreply.github.com>
|
82
109
|
* Terry Howe <terrylhowe@gmail.com>
|
83
110
|
* Thom Mahoney & Josh Lane <tmahoney@engineyard.com>
|
@@ -88,12 +115,14 @@
|
|
88
115
|
* Tom Maher <tmaher@tursom.org>
|
89
116
|
* Trym Skaar <trym@tryms.no>
|
90
117
|
* Tuomas Silen <tuomas.silen@nodeta.fi>
|
118
|
+
* Victor Costan <costan@gmail.com>
|
91
119
|
* Viven <vivien.schilis@gmail.com>
|
92
120
|
* Wesley Beary <geemus+github@gmail.com>
|
93
121
|
* Wesley Beary <geemus@engineyard.com>
|
94
122
|
* Wesley Beary <geemus@gmail.com>
|
95
123
|
* Wesley Beary <wbeary@engineyard.com>
|
96
124
|
* Wesley Beary <wesley@heroku.com>
|
125
|
+
* Zach Anker <zanker@squareup.com>
|
97
126
|
* chrisrhoden <carhoden@gmail.com>
|
98
127
|
* dickeyxxx <jeff@dickeyxxx.com>
|
99
128
|
* geemus (Wesley Beary) <wbeary@engineyard.com>
|
@@ -106,5 +135,6 @@
|
|
106
135
|
* rinrinne <rinrin.ne@gmail.com>
|
107
136
|
* rkyrychuk <ruslan.kyrychuk@gmail.com>
|
108
137
|
* sshaw <skye.shaw@gmail.com>
|
138
|
+
* starbelly <starbelly@pobox.com>
|
109
139
|
* twrodriguez <tw.rodriguez@gmail.com>
|
110
|
-
* zimbatm <zimbatm@zimbatm.com>
|
140
|
+
* zimbatm <zimbatm@zimbatm.com>
|
data/Gemfile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'jruby-openssl', :platform => :jruby
|
6
|
-
gem 'unicorn', :platforms => [:mri, :rbx]
|
5
|
+
gem 'jruby-openssl', '~> 0.9', :platform => :jruby
|
6
|
+
gem 'unicorn', :platforms => [:mri, :rbx], :groups => [:development, :test]
|
7
7
|
gem 'rubysl', '~> 2.0', :platform => :rbx
|
8
8
|
gem 'rack', '~> 1.6'
|
9
9
|
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
excon (0.
|
4
|
+
excon (0.58.0)
|
5
5
|
|
6
6
|
GEM
|
7
|
-
remote:
|
7
|
+
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
activesupport (3.2.6)
|
10
10
|
i18n (~> 0.6)
|
11
11
|
multi_json (~> 1.0)
|
12
12
|
backports (3.6.4)
|
13
|
-
bouncy-castle-java (1.5.0147)
|
14
13
|
chronic (0.6.7)
|
15
14
|
delorean (2.0.0)
|
16
15
|
chronic
|
16
|
+
diff-lcs (1.2.5)
|
17
17
|
eventmachine (1.0.4)
|
18
18
|
eventmachine (1.0.4-java)
|
19
19
|
ffi2-generators (0.1.1)
|
20
20
|
formatador (0.2.3)
|
21
21
|
i18n (0.6.0)
|
22
|
-
jruby-openssl (0.
|
23
|
-
|
24
|
-
json (1.8.
|
25
|
-
json (1.8.2-java)
|
22
|
+
jruby-openssl (0.9.17-java)
|
23
|
+
json (1.8.6)
|
24
|
+
json (1.8.6-java)
|
26
25
|
kgio (2.9.2)
|
27
26
|
minitest (4.7.5)
|
28
27
|
multi_json (1.3.6)
|
29
28
|
open4 (1.3.0)
|
29
|
+
puma (3.6.0)
|
30
|
+
puma (3.6.0-java)
|
30
31
|
rack (1.6.0)
|
31
32
|
rack-protection (1.2.0)
|
32
33
|
rack
|
@@ -36,6 +37,19 @@ GEM
|
|
36
37
|
rake (0.9.2.2)
|
37
38
|
rdoc (3.12)
|
38
39
|
json (~> 1.4)
|
40
|
+
rspec (3.5.0)
|
41
|
+
rspec-core (~> 3.5.0)
|
42
|
+
rspec-expectations (~> 3.5.0)
|
43
|
+
rspec-mocks (~> 3.5.0)
|
44
|
+
rspec-core (3.5.0)
|
45
|
+
rspec-support (~> 3.5.0)
|
46
|
+
rspec-expectations (3.5.0)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.5.0)
|
49
|
+
rspec-mocks (3.5.0)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.5.0)
|
52
|
+
rspec-support (3.5.0)
|
39
53
|
rubysl (2.0.14)
|
40
54
|
rubysl-abbrev (~> 2.0)
|
41
55
|
rubysl-base64 (~> 2.0)
|
@@ -269,12 +283,14 @@ DEPENDENCIES
|
|
269
283
|
delorean
|
270
284
|
eventmachine (>= 1.0.4)
|
271
285
|
excon!
|
272
|
-
jruby-openssl
|
273
|
-
json (>= 1.8.
|
286
|
+
jruby-openssl (~> 0.9)
|
287
|
+
json (>= 1.8.5)
|
274
288
|
open4
|
289
|
+
puma
|
275
290
|
rack (~> 1.6)
|
276
291
|
rake
|
277
292
|
rdoc
|
293
|
+
rspec (>= 3.5.0)
|
278
294
|
rubysl (~> 2.0)
|
279
295
|
shindo
|
280
296
|
sinatra
|
@@ -282,4 +298,4 @@ DEPENDENCIES
|
|
282
298
|
unicorn
|
283
299
|
|
284
300
|
BUNDLED WITH
|
285
|
-
1.
|
301
|
+
1.15.3
|
data/README.md
CHANGED
@@ -4,10 +4,27 @@ 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://
|
8
|
-
[![Dependency Status](https://gemnasium.com/
|
9
|
-
[![Gem Version](https://badge.fury.io/rb/excon.svg)](
|
10
|
-
[![Gittip](
|
7
|
+
[![Build Status](https://travis-ci.org/excon/excon.svg?branch=master)](https://travis-ci.org/excon/excon)
|
8
|
+
[![Dependency Status](https://gemnasium.com/excon/excon.svg)](https://gemnasium.com/excon/excon)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/excon.svg)](https://badge.fury.io/rb/excon)
|
10
|
+
[![Gittip](https://img.shields.io/gittip/geemus.svg)](https://www.gittip.com/geemus/)
|
11
|
+
|
12
|
+
* [Getting Started](#getting-started)
|
13
|
+
* [Options](#options)
|
14
|
+
* [Chunked Requests](#chunked-requests)
|
15
|
+
* [Pipelining Requests](#pipelining-requests)
|
16
|
+
* [Streaming Responses](#streaming-responses)
|
17
|
+
* [Proxy Support](#proxy-support)
|
18
|
+
* [Reusable ports](#reusable-ports)
|
19
|
+
* [Unix Socket Support](#unix-socket-support)
|
20
|
+
* [Stubs](#stubs)
|
21
|
+
* [Instrumentation](#instrumentation)
|
22
|
+
* [HTTPS client certificate](#https-client-certificate)
|
23
|
+
* [HTTPS/SSL Issues](#httpsssl-issues)
|
24
|
+
* [Getting Help](#getting-help)
|
25
|
+
* [Contributing](#contributing)
|
26
|
+
* [Plugins and Middlewares](#plugins-and-middlewares)
|
27
|
+
* [License](#license)
|
11
28
|
|
12
29
|
## Getting Started
|
13
30
|
|
@@ -119,6 +136,10 @@ connection.request(:idempotent => true)
|
|
119
136
|
# this request can be repeated safely, retry up to 6 times
|
120
137
|
connection.request(:idempotent => true, :retry_limit => 6)
|
121
138
|
|
139
|
+
# this request can be repeated safely, retry up to 6 times and sleep 5 seconds
|
140
|
+
# in between each retry
|
141
|
+
connection.request(:idempotent => true, :retry_limit => 6, :retry_interval => 5)
|
142
|
+
|
122
143
|
# set longer read_timeout (default is 60 seconds)
|
123
144
|
connection.request(:read_timeout => 360)
|
124
145
|
|
@@ -155,7 +176,7 @@ Compared to web browsers and other http client libraries, e.g. curl, Excon is a
|
|
155
176
|
connection = Excon.new('http://geemus.com/', :omit_default_port => true)
|
156
177
|
|
157
178
|
# accept gzip encoding
|
158
|
-
connection = Excon.new('http://geemus.com/', :headers => { "Accept" => "gzip" })
|
179
|
+
connection = Excon.new('http://geemus.com/', :headers => { "Accept-Encoding" => "gzip" })
|
159
180
|
|
160
181
|
# turn off peer verification (less secure)
|
161
182
|
Excon.defaults[:ssl_verify_peer] = false
|
@@ -282,6 +303,12 @@ Excon.stub({}, lambda {|request_params| {:body => request_params[:body], :status
|
|
282
303
|
|
283
304
|
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.
|
284
305
|
|
306
|
+
If you want to allow unstubbed requests without raising `StubNotFound`, set the `allow_unstubbed_requests` option either globally or per request.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
connection = Excon.new('http://example.com', :mock => true, :allow_unstubbed_requests => true)
|
310
|
+
```
|
311
|
+
|
285
312
|
To remove a previously defined stub, or all stubs:
|
286
313
|
|
287
314
|
```ruby
|
@@ -390,6 +417,20 @@ connection = Excon.new('https://example.com',
|
|
390
417
|
|
391
418
|
`client_key_pass` is optional.
|
392
419
|
|
420
|
+
If you already have loaded the certificate and key into memory, then pass it through like:
|
421
|
+
|
422
|
+
```ruby
|
423
|
+
client_cert_data = File.load 'mycert.pem'
|
424
|
+
client_key_data = File.load 'mycert.key'
|
425
|
+
|
426
|
+
connection = Excon.new('https://example.com',
|
427
|
+
client_cert_data: client_cert_data,
|
428
|
+
client_key_data: client_key_data)
|
429
|
+
```
|
430
|
+
|
431
|
+
This can be useful if your program has already loaded the assets through
|
432
|
+
another mechanism (E.g. a remote API call to a secure K:V system like Vault).
|
433
|
+
|
393
434
|
## HTTPS/SSL Issues
|
394
435
|
|
395
436
|
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 ...`
|
@@ -417,6 +458,27 @@ Either of these should allow you to work around the socket error and continue wi
|
|
417
458
|
|
418
459
|
Please refer to [CONTRIBUTING.md](https://github.com/excon/excon/blob/master/CONTRIBUTING.md).
|
419
460
|
|
461
|
+
# Plugins and Middlewares
|
462
|
+
|
463
|
+
Using Excon's [Middleware system][middleware], you can easily extend Excon's
|
464
|
+
functionality with your own. The following plugins extend Excon in their own
|
465
|
+
way:
|
466
|
+
|
467
|
+
* [excon-addressable](https://github.com/JeanMertz/excon-addressable)
|
468
|
+
|
469
|
+
Set [addressable](https://github.com/sporkmonger/addressable) as the default
|
470
|
+
URI parser, and add support for [URI templating][templating].
|
471
|
+
|
472
|
+
* [excon-hypermedia](https://github.com/JeanMertz/excon-hypermedia)
|
473
|
+
|
474
|
+
Teaches Excon to talk with [HyperMedia APIs][hypermedia]. Allowing you to use
|
475
|
+
all of Excon's functionality, while traversing APIs in an easy and
|
476
|
+
self-discovering way.
|
477
|
+
|
420
478
|
## License
|
421
479
|
|
422
480
|
Please refer to [LICENSE.md](https://github.com/excon/excon/blob/master/LICENSE.md).
|
481
|
+
|
482
|
+
[middleware]: lib/excon/middlewares/base.rb
|
483
|
+
[hypermedia]: https://en.wikipedia.org/wiki/HATEOAS
|
484
|
+
[templating]: https://www.rfc-editor.org/rfc/rfc6570.txt
|
data/Rakefile
CHANGED
@@ -44,9 +44,19 @@ end
|
|
44
44
|
#############################################################################
|
45
45
|
|
46
46
|
require 'shindo/rake'
|
47
|
+
require "rspec/core/rake_task"
|
48
|
+
|
49
|
+
RSpec::Core::RakeTask.new(:spec, :format) do |t, args|
|
50
|
+
format = args[:format] || 'doc'
|
51
|
+
t.rspec_opts = ["-c", "-f #{format}", "-r ./spec/spec_helper.rb"]
|
52
|
+
t.pattern = 'spec/**/*_spec.rb'
|
53
|
+
end
|
54
|
+
|
55
|
+
|
47
56
|
Shindo::Rake.new
|
48
57
|
|
49
|
-
task :default => :tests
|
58
|
+
task :default => [ :tests, :test]
|
59
|
+
task :test => :spec
|
50
60
|
|
51
61
|
require 'rdoc/task'
|
52
62
|
Rake::RDocTask.new do |rdoc|
|
@@ -136,9 +146,22 @@ end
|
|
136
146
|
|
137
147
|
desc "update bundled certs"
|
138
148
|
task :update_certs do
|
149
|
+
# update curl bundle for end-users
|
139
150
|
require File.join(File.dirname(__FILE__), 'lib', 'excon')
|
140
151
|
File.open(File.join(File.dirname(__FILE__), 'data', 'cacert.pem'), 'w') do |file|
|
141
152
|
data = Excon.get("https://curl.haxx.se/ca/cacert.pem").body
|
142
153
|
file.write(data)
|
143
154
|
end
|
155
|
+
|
156
|
+
# update self-signed certs for tests
|
157
|
+
sh "openssl req -subj '/CN=excon/O=excon' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout tests/data/excon.cert.key -out tests/data/excon.cert.crt"
|
158
|
+
sh "openssl req -subj '/CN=127.0.0.1/O=excon' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout tests/data/127.0.0.1.cert.key -out tests/data/127.0.0.1.cert.crt"
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
desc "check ssl settings"
|
163
|
+
task :hows_my_ssl do
|
164
|
+
require File.join(File.dirname(__FILE__), 'lib', 'excon')
|
165
|
+
data = Excon.get("https://www.howsmyssl.com/a/check").body
|
166
|
+
puts data
|
144
167
|
end
|
@@ -5,17 +5,18 @@ key = 'Content-Length'
|
|
5
5
|
value = '100'
|
6
6
|
Tach.meter(1_000) do
|
7
7
|
tach('concat') do
|
8
|
-
|
8
|
+
temp = ''
|
9
|
+
temp << key << ': ' << value << "\r\n"
|
9
10
|
end
|
10
11
|
tach('interpolate') do
|
11
|
-
"#{key}: value\r\n"
|
12
|
+
"#{key}: #{value}\r\n"
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
16
|
# +-------------+----------+
|
16
17
|
# | tach | total |
|
17
18
|
# +-------------+----------+
|
18
|
-
# |
|
19
|
+
# | interpolate | 0.000404 |
|
20
|
+
# +-------------+----------+
|
21
|
+
# | concat | 0.000564 |
|
19
22
|
# +-------------+----------+
|
20
|
-
# | interpolate | 0.019667 |
|
21
|
-
# +-------------+----------+
|
data/changelog.txt
CHANGED
@@ -1,3 +1,77 @@
|
|
1
|
+
0.57.1 06/30/2017
|
2
|
+
=================
|
3
|
+
|
4
|
+
fix remote-ip setting to prevent off-by-one issue
|
5
|
+
|
6
|
+
0.57.0 06/14/2017
|
7
|
+
=================
|
8
|
+
|
9
|
+
add client_key_data and client_cert_data to valid keys
|
10
|
+
allow passing explicit host to unix sockets
|
11
|
+
|
12
|
+
0.56.0 05/31/2017
|
13
|
+
=================
|
14
|
+
|
15
|
+
fix proxy parse errors
|
16
|
+
fix url-escaped proxy creds for ssl
|
17
|
+
|
18
|
+
0.55.0 02/07/2017
|
19
|
+
=================
|
20
|
+
|
21
|
+
fix minor readme error
|
22
|
+
update bundled certs
|
23
|
+
update self-signed certs
|
24
|
+
update to test with ruby 2.3.3
|
25
|
+
fix unitialized ResponseParseError error
|
26
|
+
add missing 'spec_helper' require in tests
|
27
|
+
add missing 'time' require in tests
|
28
|
+
use unescape_uri for user/pass in Authorization header
|
29
|
+
use secure rubygems source uri
|
30
|
+
update gemnasium badge
|
31
|
+
update fury badge
|
32
|
+
update travis badge
|
33
|
+
update gittip badge
|
34
|
+
|
35
|
+
0.54.0 10/17/2016
|
36
|
+
=================
|
37
|
+
|
38
|
+
add howsmyssl rake task for sanity checking
|
39
|
+
update default ciphers to mozilla intermediate list
|
40
|
+
fix typo in changelog
|
41
|
+
|
42
|
+
0.53.0 09/27/2016
|
43
|
+
=================
|
44
|
+
|
45
|
+
add ability to pass ssl options as strings
|
46
|
+
progress towards rspec
|
47
|
+
update bundled certs
|
48
|
+
|
49
|
+
0.52.0 08/22/2016
|
50
|
+
=================
|
51
|
+
|
52
|
+
freeze string literals
|
53
|
+
move toward interpolation, over concatenation (frozen string related)
|
54
|
+
start conversion toward rspec
|
55
|
+
move user/pass authorization header setting to request level
|
56
|
+
|
57
|
+
0.51.0 07/08/2016
|
58
|
+
=================
|
59
|
+
|
60
|
+
tweak new errors to be an alias rather than inherit
|
61
|
+
|
62
|
+
0.50.1 06/28/2016
|
63
|
+
=================
|
64
|
+
|
65
|
+
re-add some missing errors from refactoring
|
66
|
+
|
67
|
+
0.50.0 06/28/2016
|
68
|
+
=================
|
69
|
+
|
70
|
+
expand readme
|
71
|
+
refactor errors for consistancy
|
72
|
+
optionally allow unstubbed requests
|
73
|
+
parse/verify path as well as host for connection
|
74
|
+
|
1
75
|
0.49.0 03/28/2016
|
2
76
|
=================
|
3
77
|
|
@@ -428,7 +502,8 @@ fix logic error in dropping default ports
|
|
428
502
|
0.22.0 05/17/2013
|
429
503
|
=================
|
430
504
|
|
431
|
-
remove request/response info from default error messages to avoid
|
505
|
+
remove request/response info from default error messages to avoid
|
506
|
+
credential leaks
|
432
507
|
add option to omit default ports (http:80 and https:443)
|
433
508
|
add examples for form encoding
|
434
509
|
updates to facilitate streaming responses from middleware responses
|
@@ -494,7 +569,8 @@ move uri parsing to Excon.new
|
|
494
569
|
allow for configurable URI parser (ie Addressable vs URI)
|
495
570
|
move VALID_CONNECTION_KEYS to constants
|
496
571
|
move idempotent tests to middleware directory
|
497
|
-
fix output of expects middleware to pass response objects instead of
|
572
|
+
fix output of expects middleware to pass response objects instead of
|
573
|
+
hashes
|
498
574
|
|
499
575
|
0.18.5 02/22/2013
|
500
576
|
=================
|
@@ -620,7 +696,7 @@ update readme to describe nonblock and idempotent options
|
|
620
696
|
|
621
697
|
consolidate proxy handling
|
622
698
|
proxy settings should pull from connection instead of params (allows
|
623
|
-
Excon.defaults[:proxy])
|
699
|
+
Excon.defaults[:proxy])
|
624
700
|
properly raise connect timeout errors
|
625
701
|
change recommended standard instrumentor ENV to EXCON_DEBUG
|
626
702
|
remove readline nonblock protections (they didn't fix the windows issue)
|
@@ -632,7 +708,8 @@ use Excon::Response#parse to read https proxy response
|
|
632
708
|
0.15.4 07/16/12
|
633
709
|
===============
|
634
710
|
|
635
|
-
rescue/retry nonblock errors from readline (even though they shouldn't
|
711
|
+
rescue/retry nonblock errors from readline (even though they shouldn't
|
712
|
+
occur)
|
636
713
|
|
637
714
|
0.15.3 07/16/12
|
638
715
|
===============
|
@@ -679,7 +756,8 @@ respect upper case env vars
|
|
679
756
|
0.14.0 05/31/12
|
680
757
|
===============
|
681
758
|
|
682
|
-
make stubs LIFO for ease of use/understanding, updated README to
|
759
|
+
make stubs LIFO for ease of use/understanding, updated README to
|
760
|
+
explain
|
683
761
|
simplify https proxy logic
|
684
762
|
add instrumentation for responses
|
685
763
|
add StandardInstrumentor (events got to stderr)
|
@@ -698,7 +776,8 @@ EXCON_STANDARD_INSTRUMENTOR=true sets StandardInstrumentor as default
|
|
698
776
|
0.13.2 03/26/12
|
699
777
|
===============
|
700
778
|
|
701
|
-
* fix to avoid issues when Tempfile is not required/defined. Thanks
|
779
|
+
* fix to avoid issues when Tempfile is not required/defined. Thanks
|
780
|
+
nextmat
|
702
781
|
|
703
782
|
0.13.1 03/26/12
|
704
783
|
===============
|
@@ -731,7 +810,8 @@ EXCON_STANDARD_INSTRUMENTOR=true sets StandardInstrumentor as default
|
|
731
810
|
0.10.0 03/01/12
|
732
811
|
===============
|
733
812
|
|
734
|
-
* avoid setting/passing Content-Length headers for GET requests with
|
813
|
+
* avoid setting/passing Content-Length headers for GET requests with
|
814
|
+
no body
|
735
815
|
* remove rcov from tasks/bundle in development
|
736
816
|
* automatically parse and use basic auth when passed as part of a uri
|
737
817
|
* fix for erroneous recursion in Excon.defaults=
|
@@ -885,14 +965,16 @@ EXCON_STANDARD_INSTRUMENTOR=true sets StandardInstrumentor as default
|
|
885
965
|
* add block support to mocks. thanks dmeiz
|
886
966
|
* fixes for stub matching. thanks dmeiz
|
887
967
|
* don't do post_connection_check if verify mode is off
|
888
|
-
* check excon state for verify mode instead of checking OpenSSL
|
968
|
+
* check excon state for verify mode instead of checking OpenSSL
|
969
|
+
constants
|
889
970
|
* use RbConfig to find OS. thanks trym
|
890
971
|
* fixes for idempotent/retry. thanks lstoll
|
891
972
|
|
892
973
|
0.6.3 05/02/11
|
893
974
|
==============
|
894
975
|
|
895
|
-
* fixes for header parsing to allow whitespace after :. thanks
|
976
|
+
* fixes for header parsing to allow whitespace after :. thanks
|
977
|
+
myronmarston
|
896
978
|
* get_header optimization. thanks nextmat
|
897
979
|
* rewind body on retry. thanks pweldon
|
898
980
|
|
@@ -905,8 +987,10 @@ EXCON_STANDARD_INSTRUMENTOR=true sets StandardInstrumentor as default
|
|
905
987
|
==============
|
906
988
|
|
907
989
|
* add support for HTTPS proxies. thanks mrowe
|
908
|
-
* add support for http_proxy and https_proxy ENV variables. thanks
|
909
|
-
|
990
|
+
* add support for http_proxy and https_proxy ENV variables. thanks
|
991
|
+
mrowe
|
992
|
+
* fix progress for requests with blocks that are chunked or connection
|
993
|
+
close
|
910
994
|
|
911
995
|
0.6.0 03/30/11
|
912
996
|
==============
|
@@ -918,8 +1002,10 @@ EXCON_STANDARD_INSTRUMENTOR=true sets StandardInstrumentor as default
|
|
918
1002
|
0.5.8 03/24/11
|
919
1003
|
==============
|
920
1004
|
|
921
|
-
* fix regression where nil values in queries were ignored in 1.9.
|
922
|
-
|
1005
|
+
* fix regression where nil values in queries were ignored in 1.9.
|
1006
|
+
thanks mattsa
|
1007
|
+
* fix regression causing EOFError when making many connections in one
|
1008
|
+
thread
|
923
1009
|
* added tests to prevent both of the former from recurring
|
924
1010
|
|
925
1011
|
0.5.7 03/21/11
|
@@ -929,21 +1015,25 @@ EXCON_STANDARD_INSTRUMENTOR=true sets StandardInstrumentor as default
|
|
929
1015
|
* add rough first pass at stubbing
|
930
1016
|
* minor optimizations
|
931
1017
|
* ssl client certification support. thanks thommay
|
932
|
-
* skip figuring out/setting Content-Length if one is supplied. Thanks
|
1018
|
+
* skip figuring out/setting Content-Length if one is supplied. Thanks
|
1019
|
+
pweldon
|
933
1020
|
* do not try to parse body for 205 and 304. Thanks seancribbs
|
934
1021
|
|
935
1022
|
0.5.6 02/19/11
|
936
1023
|
==============
|
937
1024
|
|
938
|
-
* only split headers by first ':' to allow for values with ':'. Thanks
|
939
|
-
|
1025
|
+
* only split headers by first ':' to allow for values with ':'. Thanks
|
1026
|
+
mtodd!
|
1027
|
+
* check a string instance for force_encoding, not class. Thanks
|
1028
|
+
seancribbs!
|
940
1029
|
* add benchmarks related to for vs each for enumerable. Thanks caius!
|
941
1030
|
* fix default rake task to run tests
|
942
1031
|
|
943
1032
|
0.5.5 02/18/11
|
944
1033
|
==============
|
945
1034
|
|
946
|
-
* use local variables in response parsing, prevents keeping state
|
1035
|
+
* use local variables in response parsing, prevents keeping state
|
1036
|
+
across requests
|
947
1037
|
|
948
1038
|
0.5.4 02/18/11
|
949
1039
|
==============
|