typhoeus 1.6.0 → 1.7.0
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/CHANGELOG.md +217 -1
- data/README.md +338 -160
- data/UPGRADE.md +29 -0
- data/lib/rack/typhoeus/middleware/params_decoder/helper.rb +67 -14
- data/lib/rack/typhoeus/middleware/params_decoder.rb +8 -19
- data/lib/rack/typhoeus.rb +2 -0
- data/lib/typhoeus/adapters/faraday.rb +89 -28
- data/lib/typhoeus/cache/dalli.rb +2 -0
- data/lib/typhoeus/cache/rails.rb +3 -1
- data/lib/typhoeus/cache/redis.rb +2 -0
- data/lib/typhoeus/config.rb +51 -7
- data/lib/typhoeus/easy_factory.rb +129 -23
- data/lib/typhoeus/errors/invalid_option.rb +23 -0
- data/lib/typhoeus/errors/no_response.rb +18 -0
- data/lib/typhoeus/errors/no_stub.rb +8 -1
- data/lib/typhoeus/errors/typhoeus_error.rb +2 -0
- data/lib/typhoeus/errors.rb +4 -0
- data/lib/typhoeus/expectation.rb +33 -1
- data/lib/typhoeus/hydra/queueable.rb +29 -4
- data/lib/typhoeus/hydra.rb +349 -21
- data/lib/typhoeus/pool.rb +80 -17
- data/lib/typhoeus/railtie.rb +4 -2
- data/lib/typhoeus/request/actions.rb +2 -0
- data/lib/typhoeus/request/callbacks.rb +11 -4
- data/lib/typhoeus/request/marshal.rb +5 -2
- data/lib/typhoeus/request/streamable.rb +2 -0
- data/lib/typhoeus/request.rb +317 -30
- data/lib/typhoeus/response/cacheable.rb +2 -0
- data/lib/typhoeus/response/header.rb +234 -14
- data/lib/typhoeus/response/informations.rb +75 -12
- data/lib/typhoeus/response/status.rb +4 -13
- data/lib/typhoeus/response.rb +35 -0
- data/lib/typhoeus/version.rb +3 -1
- data/lib/typhoeus.rb +89 -26
- data/typhoeus.gemspec +15 -3
- metadata +19 -22
- data/lib/typhoeus/hydra/addable.rb +0 -23
- data/lib/typhoeus/hydra/before.rb +0 -31
- data/lib/typhoeus/hydra/block_connection.rb +0 -35
- data/lib/typhoeus/hydra/cacheable.rb +0 -15
- data/lib/typhoeus/hydra/memoizable.rb +0 -56
- data/lib/typhoeus/hydra/runnable.rb +0 -19
- data/lib/typhoeus/hydra/stubbable.rb +0 -28
- data/lib/typhoeus/request/before.rb +0 -30
- data/lib/typhoeus/request/block_connection.rb +0 -52
- data/lib/typhoeus/request/cacheable.rb +0 -38
- data/lib/typhoeus/request/memoizable.rb +0 -38
- data/lib/typhoeus/request/operations.rb +0 -40
- data/lib/typhoeus/request/responseable.rb +0 -29
- data/lib/typhoeus/request/stubbable.rb +0 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ab1455058aeb81e32020b6a240109da398b23efe980c74cdca23a2834d7f9d6
|
|
4
|
+
data.tar.gz: 0ed2cde548d3c93499a1bfdc8f7a20f4290a4c7796e5a429c02e7dda4d1dff5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f455d141d493ee5c69a6d3235380fae955b83f87306a18f4d6a36722c5a513edd0fa4c6fbe94497a716e93dd57e87ceb779efe09e11e8aaa290180ca8258ca2d
|
|
7
|
+
data.tar.gz: b8a2c09e5a304e74f65846a433f54bddeb4655d20d48673aca401d9a4e9994d11e14c2bfe2661c1b266dacff6837ead0f03baa49b86c5fb251209f69d3f4ee27
|
data/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,223 @@
|
|
|
2
2
|
|
|
3
3
|
## Master
|
|
4
4
|
|
|
5
|
-
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v1.
|
|
5
|
+
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v1.7.0...master)
|
|
6
|
+
|
|
7
|
+
## 1.7.0
|
|
8
|
+
|
|
9
|
+
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v1.6.0...v1.7.0)
|
|
10
|
+
|
|
11
|
+
This release requires Ethon 0.19 and changes several public behaviors.
|
|
12
|
+
Review the breaking changes and `UPGRADE.md` before upgrading.
|
|
13
|
+
|
|
14
|
+
### Breaking changes
|
|
15
|
+
|
|
16
|
+
* Require Ethon >= 0.19.0. Release easy handles when callbacks raise, clean up
|
|
17
|
+
failed hydra runs without dropping queued requests, drop inherited handles
|
|
18
|
+
after fork, and document fork and empty-header behavior. Ethon 0.19 also
|
|
19
|
+
propagates callback exceptions, rejects handles inherited across `fork`,
|
|
20
|
+
validates enum and bitmask options, and fixes multipart PUT requests.
|
|
21
|
+
* Constrain the Ethon dependency to `< 0.20` so a future pre-1.0 minor
|
|
22
|
+
release cannot introduce breaking changes unnoticed.
|
|
23
|
+
* Call `on_progress` callbacks with the documented four arguments. A lambda
|
|
24
|
+
with four parameters no longer raises `ArgumentError`.
|
|
25
|
+
* Raise `ArgumentError` for a non-positive `Hydra` `max_concurrency`, including
|
|
26
|
+
when it is assigned after the hydra is created, instead of leaving every
|
|
27
|
+
queued request unperformed.
|
|
28
|
+
([#753](https://github.com/typhoeus/typhoeus/pull/753))
|
|
29
|
+
* Raise `ArgumentError` with the option name for non-numeric timeout options
|
|
30
|
+
instead of failing with `NoMethodError` inside option sanitization.
|
|
31
|
+
([#758](https://github.com/typhoeus/typhoeus/pull/758))
|
|
32
|
+
* Raise `Typhoeus::Errors::NoResponse` when a stub has no response or its
|
|
33
|
+
response block returns `nil` or a non-`Response` object.
|
|
34
|
+
([#776](https://github.com/typhoeus/typhoeus/pull/776))
|
|
35
|
+
|
|
36
|
+
### Behavior changes
|
|
37
|
+
|
|
38
|
+
* Make `Typhoeus.with_connection` thread-local so it no longer unblocks
|
|
39
|
+
requests in other threads.
|
|
40
|
+
([#813](https://github.com/typhoeus/typhoeus/pull/813))
|
|
41
|
+
* Make `Typhoeus.with_connection` apply across fibers in the current thread
|
|
42
|
+
by using thread variables instead of fiber-local storage.
|
|
43
|
+
* Bypass stubs inside `Typhoeus.with_connection`. A stub can now forward its
|
|
44
|
+
request to the real service without matching itself in an endless loop, and
|
|
45
|
+
the real response is not finished a second time.
|
|
46
|
+
([#809](https://github.com/typhoeus/typhoeus/pull/809))
|
|
47
|
+
* Return the response from a `before` callback that short-circuits a request
|
|
48
|
+
instead of returning `nil`.
|
|
49
|
+
([#748](https://github.com/typhoeus/typhoeus/pull/748))
|
|
50
|
+
* Mark responses returned by `before` callbacks as mock responses. They are no
|
|
51
|
+
longer cached, and `success?` works for them.
|
|
52
|
+
* Finish every request that reuses a stubbed `Response` instead of treating the
|
|
53
|
+
response as already handled.
|
|
54
|
+
* Keep queued requests when a hydra run fails after reaching the multi, so a
|
|
55
|
+
caller can retry them after handling the error.
|
|
56
|
+
* Create a Hydra's native multi handle on first use. Creating or memoizing a
|
|
57
|
+
hydra during boot no longer initializes libcurl, which Ethon 0.19 rejects in
|
|
58
|
+
a forked child.
|
|
59
|
+
([#790](https://github.com/typhoeus/typhoeus/pull/790))
|
|
60
|
+
* Do not create a Hydra's native multi handle when every queued request is
|
|
61
|
+
answered by a `before` callback, a stub, or the cache.
|
|
62
|
+
([#802](https://github.com/typhoeus/typhoeus/pull/802))
|
|
63
|
+
* Only invoke `on_progress` callbacks while libcurl transfers data. They are no
|
|
64
|
+
longer called with a `Response` when the request completes, and global
|
|
65
|
+
`Typhoeus.on_progress` callbacks now run during the transfer as well.
|
|
66
|
+
([#750](https://github.com/typhoeus/typhoeus/pull/750))
|
|
67
|
+
* Only cache complete, successful, non-mock responses and replay `on_headers`
|
|
68
|
+
and `on_body` callbacks for cache hits.
|
|
69
|
+
([#763](https://github.com/typhoeus/typhoeus/pull/763))
|
|
70
|
+
* Exclude `cache_ttl` from `Request#cache_key`. Changing the TTL no longer
|
|
71
|
+
misses responses cached by an equivalent request with a different TTL.
|
|
72
|
+
([#751](https://github.com/typhoeus/typhoeus/pull/751))
|
|
73
|
+
* Make `Request#cache_key` unambiguous for values that stringify the same, and
|
|
74
|
+
return a libcurl error instead of raising for an empty URL with params.
|
|
75
|
+
([#768](https://github.com/typhoeus/typhoeus/pull/768))
|
|
76
|
+
* Normalize the request method and URL for cache keys, equality, and
|
|
77
|
+
memoization. `Typhoeus.get`, an implicit GET, `method: "GET"`, and a URI base
|
|
78
|
+
URL now refer to the same request.
|
|
79
|
+
([#789](https://github.com/typhoeus/typhoeus/pull/789))
|
|
80
|
+
* Apply `timeout_ms` and `connecttimeout_ms` after their second-based options,
|
|
81
|
+
so an explicit millisecond timeout is no longer overridden by `timeout` or
|
|
82
|
+
`Typhoeus::Config.timeout`.
|
|
83
|
+
([#788](https://github.com/typhoeus/typhoeus/pull/788))
|
|
84
|
+
* Merge the default `User-Agent` and `Expect` headers case-insensitively. A
|
|
85
|
+
caller using a lowercase header name no longer sends a duplicate value.
|
|
86
|
+
([#784](https://github.com/typhoeus/typhoeus/pull/784))
|
|
87
|
+
* Run `on_headers` callbacks for memoized followers, disable memoization for
|
|
88
|
+
streaming requests whose body is not retained, and set `request.hydra` when a
|
|
89
|
+
request is added directly.
|
|
90
|
+
([#774](https://github.com/typhoeus/typhoeus/pull/774))
|
|
91
|
+
|
|
92
|
+
### Enhancements
|
|
93
|
+
|
|
94
|
+
* Use `SSL_CERT_FILE` and `SSL_CERT_DIR` as the default `cainfo` and `capath`
|
|
95
|
+
when the request does not set them.
|
|
96
|
+
* Unroll the include chains in `Hydra#add`/`Hydra#run` and
|
|
97
|
+
`Request#run`/`Request#response=`. The ordering of the before, stub, block
|
|
98
|
+
connection, cache, memoization, and transfer checks is now explicit.
|
|
99
|
+
`Typhoeus::Config.exclude_features = [:before]` skips before callbacks for
|
|
100
|
+
every request, and `bundle exec rake perf` benchmarks the request hot path.
|
|
101
|
+
([#815](https://github.com/typhoeus/typhoeus/pull/815))
|
|
102
|
+
* Bound the easy pool with `Typhoeus::Config.max_idle_easies` (20 by default)
|
|
103
|
+
and replace the pool mutex after a fork instead of deadlocking on the
|
|
104
|
+
inherited lock.
|
|
105
|
+
([#761](https://github.com/typhoeus/typhoeus/pull/761))
|
|
106
|
+
* Honor Faraday `verify_hostname` and SSL version options, and preserve the
|
|
107
|
+
response reason phrase.
|
|
108
|
+
([#766](https://github.com/typhoeus/typhoeus/pull/766))
|
|
109
|
+
* Honor Faraday's `read_timeout` in the Typhoeus adapter, falling back to the
|
|
110
|
+
general `timeout` when it is not set.
|
|
111
|
+
([#798](https://github.com/typhoeus/typhoeus/pull/798))
|
|
112
|
+
* Let `Expect: nil` opt out of Typhoeus's empty `Expect` header, so libcurl
|
|
113
|
+
decides when to send `100-continue`.
|
|
114
|
+
([#808](https://github.com/typhoeus/typhoeus/pull/808))
|
|
115
|
+
|
|
116
|
+
### Fixes and hardening
|
|
117
|
+
|
|
118
|
+
* Don't marshal per-request `before` callbacks. Requests with a `before`
|
|
119
|
+
callback can be dumped again.
|
|
120
|
+
([#749](https://github.com/typhoeus/typhoeus/pull/749))
|
|
121
|
+
* Release the easy handle when installing response callbacks fails.
|
|
122
|
+
([#752](https://github.com/typhoeus/typhoeus/pull/752))
|
|
123
|
+
* Build the synthetic status line for mocked responses from `response_code`/
|
|
124
|
+
`code`. It previously used the libcurl `return_code` symbol.
|
|
125
|
+
([#754](https://github.com/typhoeus/typhoeus/pull/754))
|
|
126
|
+
* Replace the hydra's multi handle after a fatal `curl_multi_perform` error so
|
|
127
|
+
the hydra can run requests again.
|
|
128
|
+
([#759](https://github.com/typhoeus/typhoeus/pull/759))
|
|
129
|
+
* Load the Rack middleware and the cache adapters independent of require order.
|
|
130
|
+
([#760](https://github.com/typhoeus/typhoeus/pull/760))
|
|
131
|
+
* Drain short-circuited hydra requests iteratively and finish the request when
|
|
132
|
+
a `before` callback returns a `Response`.
|
|
133
|
+
([#762](https://github.com/typhoeus/typhoeus/pull/762))
|
|
134
|
+
* Keep callback results and per-request response objects intact when requests
|
|
135
|
+
are memoized, and clear stale memoization between runs.
|
|
136
|
+
([#764](https://github.com/typhoeus/typhoeus/pull/764))
|
|
137
|
+
* Ignore HTTP/1.1 trailer blocks when parsing response headers and keep
|
|
138
|
+
`Response::Header` mutations in sync with case-insensitive reads.
|
|
139
|
+
([#765](https://github.com/typhoeus/typhoeus/pull/765))
|
|
140
|
+
* Decode parameters for hash-like objects such as
|
|
141
|
+
`ActionController::Parameters`, deep-copy in `decode`, and register the Rack
|
|
142
|
+
middleware class in the Railtie.
|
|
143
|
+
([#767](https://github.com/typhoeus/typhoeus/pull/767))
|
|
144
|
+
* Raise `Ethon::Errors::InvalidOption` with a clean message for removed and
|
|
145
|
+
replaced options instead of wrapping the error message as the option name.
|
|
146
|
+
([#770](https://github.com/typhoeus/typhoeus/pull/770))
|
|
147
|
+
* Build `Request#url` from the URL-related options only, so unrelated invalid
|
|
148
|
+
options do not break it, and fall back to the base URL in `NoStub` when the
|
|
149
|
+
full URL cannot be built.
|
|
150
|
+
([#771](https://github.com/typhoeus/typhoeus/pull/771))
|
|
151
|
+
* Make duplicated responses independent. Memoized followers no longer share
|
|
152
|
+
options, headers, body strings, or the leader's `handled_response`, and
|
|
153
|
+
`Header.new(header)` preserves its values.
|
|
154
|
+
([#772](https://github.com/typhoeus/typhoeus/pull/772))
|
|
155
|
+
* Keep `Response::Header` case-insensitive lookups in sync after `delete_if`,
|
|
156
|
+
`select!`, `keep_if`, `reject!`, `shift`, `compact!`, and `transform_*!`.
|
|
157
|
+
([#773](https://github.com/typhoeus/typhoeus/pull/773))
|
|
158
|
+
* Make `Request#encoded_body` match the form sent on the wire, including
|
|
159
|
+
`params_encoding` and escaping.
|
|
160
|
+
([#775](https://github.com/typhoeus/typhoeus/pull/775))
|
|
161
|
+
* Keep pooling easy handles when libcurl was built without cookie support, and
|
|
162
|
+
validate `Typhoeus::Config.max_idle_easies` when it is assigned.
|
|
163
|
+
([#777](https://github.com/typhoeus/typhoeus/pull/777))
|
|
164
|
+
* Read Rails cache entries with the same cache key that was written.
|
|
165
|
+
([#778](https://github.com/typhoeus/typhoeus/pull/778))
|
|
166
|
+
* Deliver an independent response for cache hits so `on_headers` callbacks and
|
|
167
|
+
`handled_response` from an earlier request do not leak into the cached object.
|
|
168
|
+
([#781](https://github.com/typhoeus/typhoeus/pull/781))
|
|
169
|
+
* Finish memoized followers when a completion callback changes the leader's
|
|
170
|
+
options before the memoization bookkeeping runs.
|
|
171
|
+
([#782](https://github.com/typhoeus/typhoeus/pull/782))
|
|
172
|
+
* Clean up the native easy handles when `Typhoeus::Pool.clear` empties the pool
|
|
173
|
+
instead of leaking them.
|
|
174
|
+
([#783](https://github.com/typhoeus/typhoeus/pull/783))
|
|
175
|
+
* Include the replacement or removal hint in every rendering of
|
|
176
|
+
`Typhoeus::Errors::InvalidOption`, not only in `#message`.
|
|
177
|
+
([#785](https://github.com/typhoeus/typhoeus/pull/785))
|
|
178
|
+
* Copy arrays in the Rack params decoder and decode encoded hashes nested in
|
|
179
|
+
arrays.
|
|
180
|
+
([#786](https://github.com/typhoeus/typhoeus/pull/786))
|
|
181
|
+
* Build `Request#encoded_body` with Ethon's request action so PUT escaping
|
|
182
|
+
matches POST.
|
|
183
|
+
([#787](https://github.com/typhoeus/typhoeus/pull/787))
|
|
184
|
+
* Store a snapshot of a response before caching it or using it as the
|
|
185
|
+
memoization leader. Mutating a response after a request no longer changes
|
|
186
|
+
later cache hits, and a leader's callbacks no longer change a follower's
|
|
187
|
+
response.
|
|
188
|
+
([#797](https://github.com/typhoeus/typhoeus/pull/797))
|
|
189
|
+
* Exclude the response from `Request#marshal_dump`. Completed requests whose
|
|
190
|
+
callbacks return non-marshalable values can be dumped again.
|
|
191
|
+
([#799](https://github.com/typhoeus/typhoeus/pull/799))
|
|
192
|
+
* Make `Response::Header#merge`, `#fetch`, and `#fetch_values` follow the
|
|
193
|
+
same case-insensitive, string-key semantics as the rest of the header API.
|
|
194
|
+
([#800](https://github.com/typhoeus/typhoeus/pull/800))
|
|
195
|
+
* Copy string and array header values when a `Response::Header` is built from
|
|
196
|
+
a hash, so mutating the response cannot change the caller's hash.
|
|
197
|
+
([#801](https://github.com/typhoeus/typhoeus/pull/801))
|
|
198
|
+
* Decode query and form parameters independently in the Rack middleware. A
|
|
199
|
+
form value no longer overwrites the query value for the same key.
|
|
200
|
+
([#803](https://github.com/typhoeus/typhoeus/pull/803))
|
|
201
|
+
* Rewind seekable upload bodies before measuring them, so an IO that was
|
|
202
|
+
already read from no longer fails with `:read_error`.
|
|
203
|
+
([#804](https://github.com/typhoeus/typhoeus/pull/804))
|
|
204
|
+
* Parse `Response#response_code` from the status line when a response was
|
|
205
|
+
built from raw headers, such as the responses returned by
|
|
206
|
+
`Response#redirections`.
|
|
207
|
+
([#805](https://github.com/typhoeus/typhoeus/pull/805))
|
|
208
|
+
|
|
209
|
+
### Documentation and maintenance
|
|
210
|
+
|
|
211
|
+
* Build the gem from a source tarball or a working tree without git instead
|
|
212
|
+
of producing an empty package.
|
|
213
|
+
* Move the test dependencies to Sinatra 3, Rack 2.2, Dalli 3, and Redis 5.
|
|
214
|
+
This also makes the Ethon master workflow pass with frozen string literals.
|
|
215
|
+
([#779](https://github.com/typhoeus/typhoeus/pull/779))
|
|
216
|
+
* Document initializing libcurl before forking on macOS to avoid
|
|
217
|
+
`objc_initializeAfterForkError`.
|
|
218
|
+
([#810](https://github.com/typhoeus/typhoeus/pull/810))
|
|
219
|
+
* Add integration coverage for Faraday adapter timeouts, including
|
|
220
|
+
`read_timeout` precedence.
|
|
221
|
+
([#811](https://github.com/typhoeus/typhoeus/pull/811))
|
|
6
222
|
|
|
7
223
|
## 1.6.0
|
|
8
224
|
|