httpx 0.23.3 → 0.23.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a826e525e4ea1e2836566d70fa8af5231580bc0836482a86b4af8a159785895
4
- data.tar.gz: 13d7e254551f8b730361f347b9570e4af4544c63d98ef1ca9a25eea51e10b340
3
+ metadata.gz: e3869ae05ccfa2903477391c3ed918d9022ebd628795a09ad9681511a2d46f77
4
+ data.tar.gz: c7d296cdbaed94327582b409463677ad549038d5785d8e296e837c243183bf43
5
5
  SHA512:
6
- metadata.gz: e1db33022d9e917911a570cd4773078dfe5feb4198fc58e65da04cfcc278fb8569af4b8754b60b7545897546f8da05f62b56557c132f02dfcfc628923d605f47
7
- data.tar.gz: bffcd04f84fd74c825d186215d919b943349c8cd7672bf030c81696956f5625216e4118e8a16f6cdea8321f62d8fc018fbd17ca8dbeb2ad667ca847aca46de44
6
+ metadata.gz: 80b74ee360f1db9632a0e1317e3a3ed5ae3ac863e5c6c637e4ba85719027e68bf1e3fcc2103b35b1fc11221bd832af911d985a7dd51eb9030cd9392bf310b591
7
+ data.tar.gz: b424d2a3e8c796cd04747bd446a06ee690f1fa5965f397b4e7ab98880ca2d34f97d8846ecccf6973b42351b15543d610dac6ca8217ba68fb53388610071e17e1
@@ -0,0 +1,5 @@
1
+ # 0.23.4
2
+
3
+ ## Bugfixes
4
+
5
+ * fix `Response::Body#read` which rewinds on every call.
@@ -0,0 +1,34 @@
1
+ # # frozen_string_literal: true
2
+
3
+ # require "mutex_m"
4
+ # require "forwardable"
5
+
6
+ # module HTTPX::Plugins
7
+ # module ResponseCache
8
+ # class FileStore < Store
9
+ # def initialize(dir = Dir.tmpdir)
10
+ # @dir = Pathname.new(dir)
11
+ # @store = {}
12
+ # @hash_store.extend(Mutex_m)
13
+ # end
14
+
15
+ # def clear
16
+ # @store.synchronize { @store.clear }
17
+ # end
18
+
19
+ # def _get(request)
20
+ # return unless File.exist?(@dir.join(request.response_cache_key))
21
+
22
+ # @store.synchronize { @store[key] }
23
+ # end
24
+
25
+ # def set(key)
26
+ # @store.synchronize do
27
+ # resps = (@store[key] ||= [])
28
+
29
+ # yield resps
30
+ # end
31
+ # end
32
+ # end
33
+ # end
34
+ # end
@@ -107,6 +107,8 @@ module HTTPX
107
107
 
108
108
  raise Error, "no decoder available for \"#{transcoder}\"" unless decoder
109
109
 
110
+ @body.rewind
111
+
110
112
  decoder.call(self, *args)
111
113
  end
112
114
 
@@ -152,9 +154,12 @@ module HTTPX
152
154
  def read(*args)
153
155
  return unless @buffer
154
156
 
155
- rewind
157
+ unless @reader
158
+ rewind
159
+ @reader = @buffer
160
+ end
156
161
 
157
- @buffer.read(*args)
162
+ @reader.read(*args)
158
163
  end
159
164
 
160
165
  def bytesize
@@ -249,14 +254,17 @@ module HTTPX
249
254
  end
250
255
  # :nocov:
251
256
 
252
- private
253
-
254
257
  def rewind
255
258
  return unless @buffer
256
259
 
260
+ # in case there's some reading going on
261
+ @reader = nil
262
+
257
263
  @buffer.rewind
258
264
  end
259
265
 
266
+ private
267
+
260
268
  def transition
261
269
  case @state
262
270
  when :idle
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.23.3"
4
+ VERSION = "0.23.4"
5
5
  end
data/sig/response.rbs CHANGED
@@ -58,6 +58,7 @@ module HTTPX
58
58
  @window_size: Integer
59
59
  @length: Integer
60
60
  @buffer: StringIO | Tempfile | nil
61
+ @reader: StringIO | Tempfile | nil
61
62
 
62
63
  def write:(String chunk) -> Integer?
63
64
 
@@ -72,10 +73,11 @@ module HTTPX
72
73
  def close: () -> void
73
74
  def closed?: () -> bool
74
75
 
76
+ def rewind: () -> void
77
+
75
78
  private
76
79
 
77
- def initialize: (Response, Options) -> untyped
78
- def rewind: () -> void
80
+ def initialize: (Response, Options) -> void
79
81
  def transition: () -> void
80
82
  def _with_same_buffer_pos: [A] () { () -> A } -> A
81
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.3
4
+ version: 0.23.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -98,6 +98,7 @@ extra_rdoc_files:
98
98
  - doc/release_notes/0_23_1.md
99
99
  - doc/release_notes/0_23_2.md
100
100
  - doc/release_notes/0_23_3.md
101
+ - doc/release_notes/0_23_4.md
101
102
  - doc/release_notes/0_2_0.md
102
103
  - doc/release_notes/0_2_1.md
103
104
  - doc/release_notes/0_3_0.md
@@ -188,6 +189,7 @@ files:
188
189
  - doc/release_notes/0_23_1.md
189
190
  - doc/release_notes/0_23_2.md
190
191
  - doc/release_notes/0_23_3.md
192
+ - doc/release_notes/0_23_4.md
191
193
  - doc/release_notes/0_2_0.md
192
194
  - doc/release_notes/0_2_1.md
193
195
  - doc/release_notes/0_3_0.md
@@ -275,6 +277,7 @@ files:
275
277
  - lib/httpx/plugins/push_promise.rb
276
278
  - lib/httpx/plugins/rate_limiter.rb
277
279
  - lib/httpx/plugins/response_cache.rb
280
+ - lib/httpx/plugins/response_cache/file_store.rb
278
281
  - lib/httpx/plugins/response_cache/store.rb
279
282
  - lib/httpx/plugins/retries.rb
280
283
  - lib/httpx/plugins/stream.rb