excon 0.49.0 → 0.50.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89343aee2679e6e6b180e22e1ae3c16f5680bd4c
4
- data.tar.gz: 354d695485716081f2b7732bbbb2b15964f8e738
3
+ metadata.gz: f4529310064351a937a923bd4646e9536bd15dbe
4
+ data.tar.gz: 9ea9272d5b6a422c3db7ad3f85282e22602b9ae2
5
5
  SHA512:
6
- metadata.gz: 35185514c9f9460e3409282f8da653832110c6e13813e964d1bc53424fccd4d9dfce972a4811bddae2c9929e19b81860c50326620675b4a23f9c71c59bda24bf
7
- data.tar.gz: 75d1f86fb2d5d66576d50b183c32d358c43408129ade13adb653a7333b1a2825083d4e66c61dfb476d78729fc4fcca087f14d24fbfa5d4d8dea02815e1efb7ef
6
+ metadata.gz: 09c72ff2ccee1a9bd2883decdac30a605b24778f00cf0ed424c66ed9e9bc85f2559a63b155f7ff7ec6f451c3a202f4a888d220a5b1a8592419e014e0ce940062
7
+ data.tar.gz: fc1fc81770caedf92ebe72f883a9934597955e90ba6ac4649b371d5d638aa3e2b0670d3b508fa2ba8180a24312f2e57bc239f7852df65d19123cc2e4bd6cefaf
@@ -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
- * Joshua Smith <kognate@gmail.com>
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>
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- excon (0.49.0)
4
+ excon (0.50.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -9,6 +9,23 @@ Excon was designed to be simple, fast and performant. It works great as a genera
9
9
  [![Gem Version](https://badge.fury.io/rb/excon.svg)](http://badge.fury.io/rb/excon)
10
10
  [![Gittip](http://img.shields.io/gittip/geemus.svg)](https://www.gittip.com/geemus/)
11
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)
28
+
12
29
  ## Getting Started
13
30
 
14
31
  Install the gem.
@@ -282,6 +299,12 @@ Excon.stub({}, lambda {|request_params| {:body => request_params[:body], :status
282
299
 
283
300
  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
301
 
302
+ If you want to allow unstubbed requests without raising `StubNotFound`, set the `allow_unstubbed_requests` option either globally or per request.
303
+
304
+ ```ruby
305
+ connection = Excon.new('http://example.com', :mock => true, :allow_unstubbed_requests => true)
306
+ ```
307
+
285
308
  To remove a previously defined stub, or all stubs:
286
309
 
287
310
  ```ruby
@@ -417,6 +440,27 @@ Either of these should allow you to work around the socket error and continue wi
417
440
 
418
441
  Please refer to [CONTRIBUTING.md](https://github.com/excon/excon/blob/master/CONTRIBUTING.md).
419
442
 
443
+ # Plugins and Middlewares
444
+
445
+ Using Excon's [Middleware system][middleware], you can easily extend Excon's
446
+ functionality with your own. The following plugins extend Excon in their own
447
+ way:
448
+
449
+ * [excon-addressable](https://github.com/JeanMertz/excon-addressable)
450
+
451
+ Set [addressable](https://github.com/sporkmonger/addressable) as the default
452
+ URI parser, and add support for [URI templating][templating].
453
+
454
+ * [excon-hypermedia](https://github.com/JeanMertz/excon-hypermedia)
455
+
456
+ Teaches Excon to talk with [HyperMedia APIs][hypermedia]. Allowing you to use
457
+ all of Excon's functionality, while traversing APIs in an easy and
458
+ self-discovering way.
459
+
420
460
  ## License
421
461
 
422
462
  Please refer to [LICENSE.md](https://github.com/excon/excon/blob/master/LICENSE.md).
463
+
464
+ [middleware]: lib/excon/middlewares/base.rb
465
+ [hypermedia]: https://en.wikipedia.org/wiki/HATEOAS
466
+ [templating]: https://www.rfc-editor.org/rfc/rfc6570.txt
@@ -1,3 +1,11 @@
1
+ 0.50.0 06/28/2016
2
+ =================
3
+
4
+ expand readme
5
+ refactor errors for consistancy
6
+ optionally allow unstubbed requests
7
+ parse/verify path as well as host for connection
8
+
1
9
  0.49.0 03/28/2016
2
10
  =================
3
11
 
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## Bundle of CA Root Certificates
3
3
  ##
4
- ## Certificate data from Mozilla as of: Wed Jan 20 04:12:04 2016
4
+ ## Certificate data from Mozilla as of: Wed Apr 20 03:12:05 2016
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -14,7 +14,7 @@
14
14
  ## Just configure this file as the SSLCACertificateFile.
15
15
  ##
16
16
  ## Conversion done with mk-ca-bundle.pl version 1.25.
17
- ## SHA1: 0ab47e2f41518f8d223eab517cb799e5b071231e
17
+ ## SHA1: 5df367cda83086392e1acdf22bfef00c48d5eba6
18
18
  ##
19
19
 
20
20
 
@@ -629,28 +629,6 @@ EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
629
629
  llpwrN9M
630
630
  -----END CERTIFICATE-----
631
631
 
632
- Staat der Nederlanden Root CA
633
- =============================
634
- -----BEGIN CERTIFICATE-----
635
- MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE
636
- ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
637
- Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w
638
- HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh
639
- bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt
640
- vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P
641
- jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca
642
- C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth
643
- vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6
644
- 22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV
645
- HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v
646
- dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN
647
- BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR
648
- EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw
649
- MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y
650
- nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR
651
- iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw==
652
- -----END CERTIFICATE-----
653
-
654
632
  UTN USERFirst Hardware Root CA
655
633
  ==============================
656
634
  -----BEGIN CERTIFICATE-----
@@ -731,41 +709,6 @@ IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
731
709
  t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
732
710
  -----END CERTIFICATE-----
733
711
 
734
- NetLock Notary (Class A) Root
735
- =============================
736
- -----BEGIN CERTIFICATE-----
737
- MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI
738
- EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
739
- dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j
740
- ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX
741
- DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH
742
- EwhCdWRhcGVzdDEn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ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz
756
- IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh
757
- IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu
758
- b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh
759
- bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg
760
- Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp
761
- bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5
762
- ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP
763
- ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB
764
- CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr
765
- KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM
766
- 8CgHrTwXZoi1/baI
767
- -----END CERTIFICATE-----
768
-
769
712
  XRamp Global CA Root
770
713
  ====================
771
714
  -----BEGIN CERTIFICATE-----
@@ -1876,30 +1819,6 @@ IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
1876
1819
  66+KAQ==
1877
1820
  -----END CERTIFICATE-----
1878
1821
 
1879
- CA Disig
1880
- ========
1881
- -----BEGIN CERTIFICATE-----
1882
- MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK
1883
- QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw
1884
- MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz
1885
- bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3
1886
- DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm
1887
- GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD
1888
- Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo
1889
- hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt
1890
- ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w
1891
- gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P
1892
- AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz
1893
- aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff
1894
- ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa
1895
- BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t
1896
- WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3
1897
- mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/
1898
- CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K
1899
- ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA
1900
- 4Z7CRneC9VkGjCFMhwnN5ag=
1901
- -----END CERTIFICATE-----
1902
-
1903
1822
  Juur-SK
1904
1823
  =======
1905
1824
  -----BEGIN CERTIFICATE-----
@@ -3891,3 +3810,56 @@ MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
3891
3810
  Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
3892
3811
  a/GRspBl9JrmkO5K
3893
3812
  -----END CERTIFICATE-----
3813
+
3814
+ SZAFIR ROOT CA2
3815
+ ===============
3816
+ -----BEGIN CERTIFICATE-----
3817
+ MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
3818
+ A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
3819
+ BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0z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
+ -----END CERTIFICATE-----
3834
+
3835
+ Certum Trusted Network CA 2
3836
+ ===========================
3837
+ -----BEGIN CERTIFICATE-----
3838
+ MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
3839
+ BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
3840
+ bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
3841
+ ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
3842
+ TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
3843
+ cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
3844
+ IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
3845
+ 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
3846
+ CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
3847
+ Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
3848
+ uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
3849
+ GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3W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FxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
3864
+ zAYspsbiDrW5viSP
3865
+ -----END CERTIFICATE-----
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'excon'
16
- s.version = '0.49.0'
17
- s.date = '2016-03-28'
16
+ s.version = '0.50.0'
17
+ s.date = '2016-06-28'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -101,7 +101,7 @@ Gem::Specification.new do |s|
101
101
  lib/excon.rb
102
102
  lib/excon/connection.rb
103
103
  lib/excon/constants.rb
104
- lib/excon/errors.rb
104
+ lib/excon/error.rb
105
105
  lib/excon/extensions/uri.rb
106
106
  lib/excon/headers.rb
107
107
  lib/excon/middlewares/base.rb
@@ -130,7 +130,7 @@ Gem::Specification.new do |s|
130
130
  tests/data/excon.cert.crt
131
131
  tests/data/excon.cert.key
132
132
  tests/data/xs
133
- tests/errors_tests.rb
133
+ tests/error_tests.rb
134
134
  tests/header_tests.rb
135
135
  tests/middlewares/canned_response_tests.rb
136
136
  tests/middlewares/capture_cookies_tests.rb
@@ -24,7 +24,7 @@ require 'excon/constants'
24
24
  require 'excon/utils'
25
25
 
26
26
  require 'excon/connection'
27
- require 'excon/errors'
27
+ require 'excon/error'
28
28
  require 'excon/headers'
29
29
  require 'excon/response'
30
30
  require 'excon/middlewares/decompress'
@@ -107,6 +107,9 @@ module Excon
107
107
  def new(url, params = {})
108
108
  uri_parser = params[:uri_parser] || defaults[:uri_parser]
109
109
  uri = uri_parser.parse(url)
110
+ if params[:path]
111
+ uri_parser.parse(params[:path])
112
+ end
110
113
  unless uri.scheme
111
114
  raise ArgumentError.new("Invalid URI: #{uri}")
112
115
  end
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
 
3
- VERSION = '0.49.0'
3
+ VERSION = '0.50.0'
4
4
 
5
5
  CR_NL = "\r\n"
6
6
 
@@ -0,0 +1,201 @@
1
+ module Excon
2
+ # Excon exception classes
3
+ class Error < StandardError
4
+ @default_status_error = :HTTPStatus
5
+
6
+ class StubNotFound < Error; end
7
+ class InvalidStub < Error; end
8
+
9
+ # Socket related errors
10
+ class Socket < Error
11
+ attr_reader :socket_error
12
+
13
+ def initialize(socket_error = Excon::Error.new)
14
+ if is_a?(Certificate) || is_a?(Excon::Errors::CertificateError)
15
+ super
16
+ else
17
+ super("#{socket_error.message} (#{socket_error.class})")
18
+ set_backtrace(socket_error.backtrace)
19
+ @socket_error = socket_error
20
+ end
21
+ end
22
+ end
23
+
24
+ # Certificate related errors
25
+ class Certificate < Socket
26
+ def initialize(socket_error = Excon::Error.new)
27
+ msg = <<-EOL
28
+ Unable to verify certificate. This may be an issue with the remote host or with Excon. Excon has certificates bundled, but these can be customized:
29
+
30
+ `Excon.defaults[:ssl_ca_path] = path_to_certs`
31
+ `ENV['SSL_CERT_DIR'] = path_to_certs`
32
+ `Excon.defaults[:ssl_ca_file] = path_to_file`
33
+ `ENV['SSL_CERT_FILE'] = path_to_file'
34
+ `Excon.defaults[:ssl_verify_callback] = callback`
35
+ (see OpenSSL::SSL::SSLContext#verify_callback)
36
+ or:
37
+ `Excon.defaults[:ssl_verify_peer] = false` (less secure).
38
+ EOL
39
+ full_message = "#{socket_error.message} (#{socket_error.class})"
40
+ full_message << ' ' + msg
41
+ super(full_message)
42
+ set_backtrace(socket_error.backtrace)
43
+ @socket_error = socket_error
44
+ end
45
+ end
46
+
47
+ class Timeout < Error; end
48
+ class ResponseParse < Error; end
49
+ class ProxyParse < Error; end
50
+ class ProxyConnection < Error; end
51
+
52
+ # Base class for HTTP Error classes
53
+ class HTTPStatus < Error
54
+ attr_reader :request, :response
55
+
56
+ def initialize(msg, request = nil, response = nil)
57
+ super(msg)
58
+ @request = request
59
+ @response = response
60
+ end
61
+ end
62
+
63
+ # HTTP Error classes
64
+ class Informational < HTTPStatus; end
65
+ class Success < HTTPStatus; end
66
+ class Redirection < HTTPStatus; end
67
+ class Client < HTTPStatus; end
68
+ class Server < HTTPStatus; end
69
+
70
+ class Continue < Informational; end # 100
71
+ class SwitchingProtocols < Informational; end # 101
72
+ class OK < Success; end # 200
73
+ class Created < Success; end # 201
74
+ class Accepted < Success; end # 202
75
+ class NonAuthoritativeInformation < Success; end # 203
76
+ class NoContent < Success; end # 204
77
+ class ResetContent < Success; end # 205
78
+ class PartialContent < Success; end # 206
79
+ class MultipleChoices < Redirection; end # 300
80
+ class MovedPermanently < Redirection; end # 301
81
+ class Found < Redirection; end # 302
82
+ class SeeOther < Redirection; end # 303
83
+ class NotModified < Redirection; end # 304
84
+ class UseProxy < Redirection; end # 305
85
+ class TemporaryRedirect < Redirection; end # 307
86
+ class BadRequest < Client; end # 400
87
+ class Unauthorized < Client; end # 401
88
+ class PaymentRequired < Client; end # 402
89
+ class Forbidden < Client; end # 403
90
+ class NotFound < Client; end # 404
91
+ class MethodNotAllowed < Client; end # 405
92
+ class NotAcceptable < Client; end # 406
93
+ class ProxyAuthenticationRequired < Client; end # 407
94
+ class RequestTimeout < Client; end # 408
95
+ class Conflict < Client; end # 409
96
+ class Gone < Client; end # 410
97
+ class LengthRequired < Client; end # 411
98
+ class PreconditionFailed < Client; end # 412
99
+ class RequestEntityTooLarge < Client; end # 413
100
+ class RequestURITooLong < Client; end # 414
101
+ class UnsupportedMediaType < Client; end # 415
102
+ class RequestedRangeNotSatisfiable < Client; end # 416
103
+ class ExpectationFailed < Client; end # 417
104
+ class UnprocessableEntity < Client; end # 422
105
+ class TooManyRequests < Client; end # 429
106
+ class InternalServer < Server; end # 500
107
+ class NotImplemented < Server; end # 501
108
+ class BadGateway < Server; end # 502
109
+ class ServiceUnavailable < Server; end # 503
110
+ class GatewayTimeout < Server; end # 504
111
+
112
+ def self.status_errors
113
+ @status_errors ||= {
114
+ 100 => [Excon::Error::Continue, 'Continue'],
115
+ 101 => [Excon::Error::SwitchingProtocols, 'Switching Protocols'],
116
+ 200 => [Excon::Error::OK, 'OK'],
117
+ 201 => [Excon::Error::Created, 'Created'],
118
+ 202 => [Excon::Error::Accepted, 'Accepted'],
119
+ 203 => [Excon::Error::NonAuthoritativeInformation, 'Non-Authoritative Information'],
120
+ 204 => [Excon::Error::NoContent, 'No Content'],
121
+ 205 => [Excon::Error::ResetContent, 'Reset Content'],
122
+ 206 => [Excon::Error::PartialContent, 'Partial Content'],
123
+ 300 => [Excon::Error::MultipleChoices, 'Multiple Choices'],
124
+ 301 => [Excon::Error::MovedPermanently, 'Moved Permanently'],
125
+ 302 => [Excon::Error::Found, 'Found'],
126
+ 303 => [Excon::Error::SeeOther, 'See Other'],
127
+ 304 => [Excon::Error::NotModified, 'Not Modified'],
128
+ 305 => [Excon::Error::UseProxy, 'Use Proxy'],
129
+ 307 => [Excon::Error::TemporaryRedirect, 'Temporary Redirect'],
130
+ 400 => [Excon::Error::BadRequest, 'Bad Request'],
131
+ 401 => [Excon::Error::Unauthorized, 'Unauthorized'],
132
+ 402 => [Excon::Error::PaymentRequired, 'Payment Required'],
133
+ 403 => [Excon::Error::Forbidden, 'Forbidden'],
134
+ 404 => [Excon::Error::NotFound, 'Not Found'],
135
+ 405 => [Excon::Error::MethodNotAllowed, 'Method Not Allowed'],
136
+ 406 => [Excon::Error::NotAcceptable, 'Not Acceptable'],
137
+ 407 => [Excon::Error::ProxyAuthenticationRequired, 'Proxy Authentication Required'],
138
+ 408 => [Excon::Error::RequestTimeout, 'Request Timeout'],
139
+ 409 => [Excon::Error::Conflict, 'Conflict'],
140
+ 410 => [Excon::Error::Gone, 'Gone'],
141
+ 411 => [Excon::Error::LengthRequired, 'Length Required'],
142
+ 412 => [Excon::Error::PreconditionFailed, 'Precondition Failed'],
143
+ 413 => [Excon::Error::RequestEntityTooLarge, 'Request Entity Too Large']
144
+ }
145
+ end
146
+
147
+ # Messages for nicer exceptions, from rfc2616
148
+ def self.status_error(request, response)
149
+ error_class, error_message = status_errors[response[:status]]
150
+ if error_class.nil?
151
+ default_class = Excon::Error.const_get(@default_status_error)
152
+ error_class, error_message = [default_class, 'Unknown']
153
+ end
154
+ message = StringIO.new
155
+ str = "Expected(#{request[:expects].inspect}) <=>"
156
+ str << " Actual(#{response[:status]} #{error_message})"
157
+ message.puts(str)
158
+ if request[:debug_request]
159
+ message.puts('excon.error.request')
160
+ Excon::PrettyPrinter.pp(message, request)
161
+ end
162
+
163
+ if request[:debug_response]
164
+ message.puts('excon.error.response')
165
+ Excon::PrettyPrinter.pp(message, response.data)
166
+ end
167
+ message.rewind
168
+ error_class.new(message.read, request, response)
169
+ end
170
+ end
171
+
172
+ # Legacy
173
+ module Errors
174
+ class Error < Excon::Error; end
175
+
176
+ legacy_re = /
177
+ \A
178
+ Client
179
+ |Server
180
+ |Socket
181
+ |Certificate
182
+ |HTTPStatus
183
+ |InternalServer
184
+ \Z
185
+ /x
186
+
187
+ klasses = Excon::Error.constants.select do |c|
188
+ Excon::Error.const_get(c).is_a? Class
189
+ end
190
+
191
+ klasses.each do |klass|
192
+ class_name = klass.to_s
193
+ class_name = klass.to_s + 'Error' if class_name =~ legacy_re
194
+ Excon::Errors.const_set(class_name, Excon::Error.const_get(klass))
195
+ end
196
+
197
+ def self.status_error(request, response)
198
+ Excon::Error.status_error(request, response)
199
+ end
200
+ end
201
+ end
@@ -35,7 +35,7 @@ module Excon
35
35
  if stub_datum.has_key?(:headers)
36
36
  datum[:response][:headers].merge!(stub_datum[:headers])
37
37
  end
38
- else
38
+ elsif datum[:allow_unstubbed_requests] != true
39
39
  # if we reach here no stubs matched
40
40
  message = StringIO.new
41
41
  message.puts('no stubs matched')
@@ -1,5 +1,9 @@
1
1
  Shindo.tests('HTTPStatusError request/response debugging') do
2
2
 
3
+ tests('new returns an Error').returns(true) do
4
+ Excon::Error.new('bar').class == Excon::Error
5
+ end
6
+
3
7
  tests('new raises errors for bad URIs').returns(true) do
4
8
  begin
5
9
  Excon.new('foo')
@@ -9,6 +13,65 @@ Shindo.tests('HTTPStatusError request/response debugging') do
9
13
  end
10
14
  end
11
15
 
16
+ tests('new raises errors for bad paths').returns(true) do
17
+ begin
18
+ Excon.new('http://localhost', path: "foo\r\nbar: baz")
19
+ false
20
+ rescue => err
21
+ err.to_s.include? "foo\r\nbar: baz"
22
+ end
23
+ end
24
+
25
+ tests('can raise standard error and catch standard error').returns(true) do
26
+ begin
27
+ raise Excon::Error::Client.new('foo')
28
+ rescue Excon::Error => e
29
+ true
30
+ end
31
+ end
32
+
33
+ tests('can raise legacy errors and catch legacy errors').returns(true) do
34
+ begin
35
+ raise Excon::Errors::Error.new('bar')
36
+ rescue Excon::Errors::Error => e
37
+ true
38
+ end
39
+ end
40
+
41
+ tests('can raise with status_error() and catch with standard error').returns(true) do
42
+ begin
43
+ raise Excon::Error.status_error({expects: 200}, {status: 400})
44
+ rescue Excon::Error
45
+ true
46
+ end
47
+ end
48
+
49
+
50
+ tests('can raise with status_error() and catch with legacy error').returns(true) do
51
+ begin
52
+ raise Excon::Error.status_error({expects: 200}, {status: 400})
53
+ rescue Excon::Errors::BadRequest
54
+ true
55
+ end
56
+ end
57
+
58
+ tests('can raise with legacy status_error() and catch with legacy').returns(true) do
59
+ begin
60
+ raise Excon::Errors.status_error({expects: 200}, {status: 400})
61
+ rescue Excon::Errors::BadRequest
62
+ true
63
+ end
64
+ end
65
+
66
+
67
+ tests('can raise with legacy status_error() and catch with standard').returns(true) do
68
+ begin
69
+ raise Excon::Errors.status_error({expects: 200}, {status: 400})
70
+ rescue Excon::Error
71
+ true
72
+ end
73
+ end
74
+
12
75
  with_server('error') do
13
76
 
14
77
  tests('message does not include response or response info').returns(true) do
@@ -53,6 +116,5 @@ Shindo.tests('HTTPStatusError request/response debugging') do
53
116
  err.message.include?('excon.error.response')
54
117
  end
55
118
  end
56
-
57
119
  end
58
120
  end
@@ -153,6 +153,17 @@ Shindo.tests('Excon stubs') do
153
153
  Excon.get('http://127.0.0.1:9292/', :mock => true)
154
154
  end
155
155
 
156
+ with_server('good') do
157
+ tests('allow mismatched stub').returns(200) do
158
+ Excon.stub({:path => '/echo/request_count'}, {:body => 'body'})
159
+ Excon.get(
160
+ 'http://127.0.0.1:9292/echo/request',
161
+ :mock => true,
162
+ :allow_unstubbed_requests => true
163
+ ).status
164
+ end
165
+ end
166
+
156
167
  Excon.stubs.clear
157
168
 
158
169
  tests("stub({}, {:body => 'x' * (Excon::DEFAULT_CHUNK_SIZE + 1)})") do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.49.0
4
+ version: 0.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-28 00:00:00.000000000 Z
13
+ date: 2016-06-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -190,7 +190,7 @@ files:
190
190
  - lib/excon.rb
191
191
  - lib/excon/connection.rb
192
192
  - lib/excon/constants.rb
193
- - lib/excon/errors.rb
193
+ - lib/excon/error.rb
194
194
  - lib/excon/extensions/uri.rb
195
195
  - lib/excon/headers.rb
196
196
  - lib/excon/middlewares/base.rb
@@ -219,7 +219,7 @@ files:
219
219
  - tests/data/excon.cert.crt
220
220
  - tests/data/excon.cert.key
221
221
  - tests/data/xs
222
- - tests/errors_tests.rb
222
+ - tests/error_tests.rb
223
223
  - tests/header_tests.rb
224
224
  - tests/middlewares/canned_response_tests.rb
225
225
  - tests/middlewares/capture_cookies_tests.rb
@@ -1,172 +0,0 @@
1
- module Excon
2
- module Errors
3
-
4
- class Error < StandardError; end
5
- class StubNotFound < StandardError; end
6
- class InvalidStub < StandardError; end
7
-
8
- class SocketError < Error
9
- attr_reader :socket_error
10
-
11
- def initialize(socket_error = Excon::Errors::Error.new)
12
- if is_a?(CertificateError)
13
- super
14
- else
15
- super("#{socket_error.message} (#{socket_error.class})")
16
- set_backtrace(socket_error.backtrace)
17
- @socket_error = socket_error
18
- end
19
- end
20
- end
21
-
22
- class CertificateError < SocketError
23
- def initialize(socket_error = Excon::Errors::Error.new)
24
- msg = "Unable to verify certificate. This may be an issue with the remote host or with Excon." +
25
- "Excon has certificates bundled, but these can be customized." +
26
- "`Excon.defaults[:ssl_ca_path] = path_to_certs`, " +
27
- "`ENV['SSL_CERT_DIR'] = path_to_certs`, " +
28
- "`Excon.defaults[:ssl_ca_file] = path_to_file`, " +
29
- "`ENV['SSL_CERT_FILE'] = path_to_file`, " +
30
- "`Excon.defaults[:ssl_verify_callback] = callback` (see OpenSSL::SSL::SSLContext#verify_callback), or " +
31
- "`Excon.defaults[:ssl_verify_peer] = false` (less secure)."
32
- full_message = "#{socket_error.message} (#{socket_error.class})" + ' ' + msg
33
- super(full_message)
34
- set_backtrace(socket_error.backtrace)
35
- @socket_error = socket_error
36
- end
37
- end
38
-
39
- class Timeout < Error; end
40
-
41
- class ResponseParseError < Error; end
42
-
43
- class ProxyParseError < Error; end
44
-
45
- class ProxyConnectionError < Error; end
46
-
47
- class HTTPStatusError < Error
48
- attr_reader :request, :response
49
-
50
- def initialize(msg, request = nil, response = nil)
51
- super(msg)
52
- @request = request
53
- @response = response
54
- end
55
- end
56
-
57
- # HTTP Error classes
58
- class Informational < HTTPStatusError; end
59
- class Success < HTTPStatusError; end
60
- class Redirection < HTTPStatusError; end
61
- class ClientError < HTTPStatusError; end
62
- class ServerError < HTTPStatusError; end
63
-
64
- class Continue < Informational; end # 100
65
- class SwitchingProtocols < Informational; end # 101
66
- class OK < Success; end # 200
67
- class Created < Success; end # 201
68
- class Accepted < Success; end # 202
69
- class NonAuthoritativeInformation < Success; end # 203
70
- class NoContent < Success; end # 204
71
- class ResetContent < Success; end # 205
72
- class PartialContent < Success; end # 206
73
- class MultipleChoices < Redirection; end # 300
74
- class MovedPermanently < Redirection; end # 301
75
- class Found < Redirection; end # 302
76
- class SeeOther < Redirection; end # 303
77
- class NotModified < Redirection; end # 304
78
- class UseProxy < Redirection; end # 305
79
- class TemporaryRedirect < Redirection; end # 307
80
- class BadRequest < ClientError; end # 400
81
- class Unauthorized < ClientError; end # 401
82
- class PaymentRequired < ClientError; end # 402
83
- class Forbidden < ClientError; end # 403
84
- class NotFound < ClientError; end # 404
85
- class MethodNotAllowed < ClientError; end # 405
86
- class NotAcceptable < ClientError; end # 406
87
- class ProxyAuthenticationRequired < ClientError; end # 407
88
- class RequestTimeout < ClientError; end # 408
89
- class Conflict < ClientError; end # 409
90
- class Gone < ClientError; end # 410
91
- class LengthRequired < ClientError; end # 411
92
- class PreconditionFailed < ClientError; end # 412
93
- class RequestEntityTooLarge < ClientError; end # 413
94
- class RequestURITooLong < ClientError; end # 414
95
- class UnsupportedMediaType < ClientError; end # 415
96
- class RequestedRangeNotSatisfiable < ClientError; end # 416
97
- class ExpectationFailed < ClientError; end # 417
98
- class UnprocessableEntity < ClientError; end # 422
99
- class TooManyRequests < ClientError; end # 429
100
- class InternalServerError < ServerError; end # 500
101
- class NotImplemented < ServerError; end # 501
102
- class BadGateway < ServerError; end # 502
103
- class ServiceUnavailable < ServerError; end # 503
104
- class GatewayTimeout < ServerError; end # 504
105
-
106
- # Messages for nicer exceptions, from rfc2616
107
- def self.status_error(request, response)
108
- @errors ||= {
109
- 100 => [Excon::Errors::Continue, 'Continue'],
110
- 101 => [Excon::Errors::SwitchingProtocols, 'Switching Protocols'],
111
- 200 => [Excon::Errors::OK, 'OK'],
112
- 201 => [Excon::Errors::Created, 'Created'],
113
- 202 => [Excon::Errors::Accepted, 'Accepted'],
114
- 203 => [Excon::Errors::NonAuthoritativeInformation, 'Non-Authoritative Information'],
115
- 204 => [Excon::Errors::NoContent, 'No Content'],
116
- 205 => [Excon::Errors::ResetContent, 'Reset Content'],
117
- 206 => [Excon::Errors::PartialContent, 'Partial Content'],
118
- 300 => [Excon::Errors::MultipleChoices, 'Multiple Choices'],
119
- 301 => [Excon::Errors::MovedPermanently, 'Moved Permanently'],
120
- 302 => [Excon::Errors::Found, 'Found'],
121
- 303 => [Excon::Errors::SeeOther, 'See Other'],
122
- 304 => [Excon::Errors::NotModified, 'Not Modified'],
123
- 305 => [Excon::Errors::UseProxy, 'Use Proxy'],
124
- 307 => [Excon::Errors::TemporaryRedirect, 'Temporary Redirect'],
125
- 400 => [Excon::Errors::BadRequest, 'Bad Request'],
126
- 401 => [Excon::Errors::Unauthorized, 'Unauthorized'],
127
- 402 => [Excon::Errors::PaymentRequired, 'Payment Required'],
128
- 403 => [Excon::Errors::Forbidden, 'Forbidden'],
129
- 404 => [Excon::Errors::NotFound, 'Not Found'],
130
- 405 => [Excon::Errors::MethodNotAllowed, 'Method Not Allowed'],
131
- 406 => [Excon::Errors::NotAcceptable, 'Not Acceptable'],
132
- 407 => [Excon::Errors::ProxyAuthenticationRequired, 'Proxy Authentication Required'],
133
- 408 => [Excon::Errors::RequestTimeout, 'Request Timeout'],
134
- 409 => [Excon::Errors::Conflict, 'Conflict'],
135
- 410 => [Excon::Errors::Gone, 'Gone'],
136
- 411 => [Excon::Errors::LengthRequired, 'Length Required'],
137
- 412 => [Excon::Errors::PreconditionFailed, 'Precondition Failed'],
138
- 413 => [Excon::Errors::RequestEntityTooLarge, 'Request Entity Too Large'],
139
- 414 => [Excon::Errors::RequestURITooLong, 'Request-URI Too Long'],
140
- 415 => [Excon::Errors::UnsupportedMediaType, 'Unsupported Media Type'],
141
- 416 => [Excon::Errors::RequestedRangeNotSatisfiable, 'Request Range Not Satisfiable'],
142
- 417 => [Excon::Errors::ExpectationFailed, 'Expectation Failed'],
143
- 422 => [Excon::Errors::UnprocessableEntity, 'Unprocessable Entity'],
144
- 429 => [Excon::Errors::TooManyRequests, 'Too Many Requests'],
145
- 500 => [Excon::Errors::InternalServerError, 'InternalServerError'],
146
- 501 => [Excon::Errors::NotImplemented, 'Not Implemented'],
147
- 502 => [Excon::Errors::BadGateway, 'Bad Gateway'],
148
- 503 => [Excon::Errors::ServiceUnavailable, 'Service Unavailable'],
149
- 504 => [Excon::Errors::GatewayTimeout, 'Gateway Timeout']
150
- }
151
-
152
- error_class, error_message = @errors[response[:status]] || [Excon::Errors::HTTPStatusError, 'Unknown']
153
-
154
- message = StringIO.new
155
- message.puts("Expected(#{request[:expects].inspect}) <=> Actual(#{response[:status]} #{error_message})")
156
-
157
- if request[:debug_request]
158
- message.puts('excon.error.request')
159
- Excon::PrettyPrinter.pp(message, request)
160
- end
161
-
162
- if request[:debug_response]
163
- message.puts('excon.error.response')
164
- Excon::PrettyPrinter.pp(message, response.data)
165
- end
166
-
167
- message.rewind
168
- error_class.new(message.read, request, response)
169
- end
170
-
171
- end
172
- end