excon 0.99.0 → 1.2.5
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 +4 -4
- data/README.md +24 -2
- data/data/cacert.pem +545 -275
- data/excon.gemspec +24 -17
- data/lib/excon/connection.rb +27 -14
- data/lib/excon/constants.rb +122 -113
- data/lib/excon/error.rb +2 -2
- data/lib/excon/middlewares/capture_cookies.rb +1 -1
- data/lib/excon/middlewares/decompress.rb +17 -22
- data/lib/excon/middlewares/redirect_follower.rb +3 -3
- data/lib/excon/response.rb +4 -4
- data/lib/excon/socket.rb +115 -25
- data/lib/excon/ssl_socket.rb +3 -2
- data/lib/excon/test/plugin/server/puma.rb +1 -1
- data/lib/excon/test/plugin/server/unicorn.rb +5 -5
- data/lib/excon/test/plugin/server/webrick.rb +1 -1
- data/lib/excon/test/server.rb +1 -3
- data/lib/excon/unix_socket.rb +1 -1
- data/lib/excon/utils.rb +39 -36
- data/lib/excon/version.rb +2 -1
- data/lib/excon.rb +39 -47
- metadata +49 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03be8d14ca6bdef68492641f26ed1fc39aab7ec53dbb4c9c7020cd8d20c47de7
|
4
|
+
data.tar.gz: 2e995618462cf8d4c40f4f05dfb4782f82fca992066fe47b5e8caefa8e721c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4680ec1d717b8bfd0718a15c2261e324cb1043f40033d2bd7a9a0bef016f9ee3b6595a8f6ed3d3e0f20581edf7bfe36c1e073726840adc66250c69aa45e17103
|
7
|
+
data.tar.gz: 290752b4fb510fd3954b21213f09373125ba04a074cef22b277f2954983651fd384d126a7a5d7f6e426a184014470621346aa840087a99803bf5c4cf3e20886c
|
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
|
-
[](https://
|
7
|
+
[](https://github.com/excon/excon/actions/workflows/ci.yml)
|
8
|
+
[](https://rubygems.org/gems/excon)
|
9
9
|
|
10
10
|
- [Getting Started](#getting-started)
|
11
11
|
- [Options](#options)
|
@@ -179,6 +179,10 @@ connection.request(:read_timeout => 360)
|
|
179
179
|
# set longer write_timeout (default is 60 seconds)
|
180
180
|
connection.request(:write_timeout => 360)
|
181
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
|
+
|
182
186
|
# Enable the socket option TCP_NODELAY on the underlying socket.
|
183
187
|
#
|
184
188
|
# This can improve response time when sending frequent short
|
@@ -186,11 +190,29 @@ connection.request(:write_timeout => 360)
|
|
186
190
|
#
|
187
191
|
connection = Excon.new('http://geemus.com/', :tcp_nodelay => true)
|
188
192
|
|
193
|
+
# opt-in to having Excon add a default port (http:80 and https:443)
|
194
|
+
connection = Excon.new('http://geemus.com/', :include_default_port => true)
|
195
|
+
|
189
196
|
# set longer connect_timeout (default is 60 seconds)
|
190
197
|
connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
|
191
198
|
|
192
199
|
# opt-out of nonblocking operations for performance and/or as a workaround
|
193
200
|
connection = Excon.new('http://geemus.com/', :nonblock => false)
|
201
|
+
|
202
|
+
# DEPRECATED in favour of `resolv_resolver` (see below)
|
203
|
+
# set up desired dns_timeouts for resolving addresses (default is set by Resolv)
|
204
|
+
# it accepts an integer or an array of integers for retrying with different timeouts
|
205
|
+
# see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
|
206
|
+
connection = Excon.new('http://geemus.com/', :dns_timeouts => 3)
|
207
|
+
|
208
|
+
# set a custom resolver for Resolv
|
209
|
+
# you can use custom nameservers and timeouts
|
210
|
+
# `timeouts` accepts an integer or an array of integers for retrying with different timeouts
|
211
|
+
# see Resolv::DNS#timeouts for more details (https://ruby-doc.org/3.2.2/stdlibs/resolv/Resolv/DNS.html#method-i-timeouts-3D)
|
212
|
+
dns_resolver = Resolv::DNS.new(nameserver: ['127.0.0.1'])
|
213
|
+
dns_resolver.timeouts = 3
|
214
|
+
resolver = Resolv.new([Resolv::Hosts.new, dns_resolver])
|
215
|
+
connection = Excon.new('http://geemus.com', :resolv_resolver => resolver)
|
194
216
|
```
|
195
217
|
|
196
218
|
## Chunked Requests
|