excon 0.92.4 → 0.92.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -26
  3. data/lib/excon/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27d135a08d31acae6470830e52c2106edb009aa323e722b8b4f33f1e363ba751
4
- data.tar.gz: 39b76ea9456a60d7bde87139cca00d58da653cc4f518ae3ca65863e9fe8fdda3
3
+ metadata.gz: a34074d556423d449fa23f52efaa7f5819f44f030df55a2cdcb59b8abc759965
4
+ data.tar.gz: d45df688f3f126ed199d9cd16616f4c29a0da2e2d6fbe4b1df85fb442ad35778
5
5
  SHA512:
6
- metadata.gz: 63cdd6010814edb1a94e7bc1c694e7dedb2cca7c51dee26fe89a7bd71fad1f2a803763d49ae0f6e8103c7114acc423e92d0c610620b97ae817a936b0990af484
7
- data.tar.gz: f759aa0467043e50c8af544c881fadab669505a7a62b58cc2a68dd7bf1be9a3e6db3656092e66618dd8161310d39deee1d841adf6ed0b8d02719574211d3d983
6
+ metadata.gz: e59218361989a91d474eb8b6076f6c3928000f77cbffabcb0f155bc41f7033a25f5606af7325c2cf63c61f0fdfe6175a84470f2e03caeb210e05ef0dc76b7bf3
7
+ data.tar.gz: a3c6c90892e9a329f9bfa4a76826c6c69f0f2945073e44a01bb348eb168ba0052c3078a2ac4e67e39158cb62c13b9d981b3af75ca147261a97af772e9c7beb82
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/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Excon
3
- VERSION = '0.92.4'
3
+ VERSION = '0.92.5'
4
4
  end
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.92.4
4
+ version: 0.92.5
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-07-20 00:00:00.000000000 Z
13
+ date: 2022-09-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec