excon 0.92.4 → 0.93.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -26
- data/lib/excon/ssl_socket.rb +1 -1
- data/lib/excon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a01332c97d386ee2fa377ba1fd77181638bc1c2d0b66bf12c438a000dfa1cf9
|
4
|
+
data.tar.gz: 58a820d5454126fca8e207a2ad73da5191530e79288bac722ce404b65d6b6b89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e37baf618e3fee07197ee59773c045aa9319532ed7e604eb9ad0df58fe44385358411e56b724bded235b0a57cf95ea6190445b27144359128abbf3e577363b87
|
7
|
+
data.tar.gz: e0376d6b306d053a8eba47fb9f188fdb96fcbbd7c11b9a9eba4deb9f7c1b55432bdb5a63b8880316ed99e078b382a36d00c1a5b3eb12be76e708c91d76689d10
|
data/README.md
CHANGED
@@ -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,6 +169,10 @@ 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
|
|
@@ -155,32 +191,6 @@ connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
|
|
155
191
|
|
156
192
|
# opt-out of nonblocking operations for performance and/or as a workaround
|
157
193
|
connection = Excon.new('http://geemus.com/', :nonblock => false)
|
158
|
-
|
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')
|
166
|
-
|
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://...')
|
184
194
|
```
|
185
195
|
|
186
196
|
## Chunked Requests
|
data/lib/excon/ssl_socket.rb
CHANGED
data/lib/excon/version.rb
CHANGED
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.
|
4
|
+
version: 0.93.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: 2022-
|
13
|
+
date: 2022-09-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|