httpx 0.23.2 → 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: 1198b505a01534dd942900f5cd82654459fbab18e89e8c4e3291717d36cfa777
4
- data.tar.gz: 02c767977043d0d80faa74d1175de23931ab5bb097fd11004df145fd1e3c2216
3
+ metadata.gz: e3869ae05ccfa2903477391c3ed918d9022ebd628795a09ad9681511a2d46f77
4
+ data.tar.gz: c7d296cdbaed94327582b409463677ad549038d5785d8e296e837c243183bf43
5
5
  SHA512:
6
- metadata.gz: 0e8bfbf580750b9fa04fd116e9a1a2b341ed488771aa10021c496d98412b0d9bac87ee5d4963d48648b8df2f85445060953e43548bb0ffab7a8f126001365aad
7
- data.tar.gz: 49297a78674a918c0cd3e10e40748bad72347fd2e4e3df9df43f16b0e179238a7271d64306e2db4eefa2160e38e8ee2f5768c9da2f2f8cebc1c1db97b8fc0821
6
+ metadata.gz: 80b74ee360f1db9632a0e1317e3a3ed5ae3ac863e5c6c637e4ba85719027e68bf1e3fcc2103b35b1fc11221bd832af911d985a7dd51eb9030cd9392bf310b591
7
+ data.tar.gz: b424d2a3e8c796cd04747bd446a06ee690f1fa5965f397b4e7ab98880ca2d34f97d8846ecccf6973b42351b15543d610dac6ca8217ba68fb53388610071e17e1
@@ -0,0 +1,6 @@
1
+ # 0.23.3
2
+
3
+ ## Bugfixes
4
+
5
+ * native resolver: fix missing exception variable in the DNS error code path.
6
+ * native resolver: fixed short DNS packet handling when using TCP.
@@ -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
@@ -198,15 +198,16 @@ module HTTPX
198
198
  return
199
199
  else
200
200
  size = @read_buffer[0, 2].unpack1("n")
201
+ buffer = @read_buffer.byteslice(2..-1)
201
202
 
202
203
  if size > @read_buffer.bytesize
203
204
  # only do buffer logic if it's worth it, and the whole packet isn't here already
204
205
  @large_packet = Buffer.new(size)
205
- @large_packet << @read_buffer.byteslice(2..-1)
206
+ @large_packet << buffer
206
207
 
207
208
  next
208
209
  else
209
- parse(@read_buffer)
210
+ parse(buffer)
210
211
  end
211
212
  end
212
213
  else # udp
@@ -266,7 +267,6 @@ module HTTPX
266
267
  reset_hostname(hostname)
267
268
  @connections.delete(connection)
268
269
  ex = NativeResolveError.new(connection, connection.origin.host, "unknown DNS error (error code #{result})")
269
- ex.set_backtrace(e.backtrace)
270
270
  raise ex
271
271
  when :decode_error
272
272
  hostname, connection = @queries.first
@@ -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.2"
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.2
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-05 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
@@ -97,6 +97,8 @@ extra_rdoc_files:
97
97
  - doc/release_notes/0_23_0.md
98
98
  - doc/release_notes/0_23_1.md
99
99
  - doc/release_notes/0_23_2.md
100
+ - doc/release_notes/0_23_3.md
101
+ - doc/release_notes/0_23_4.md
100
102
  - doc/release_notes/0_2_0.md
101
103
  - doc/release_notes/0_2_1.md
102
104
  - doc/release_notes/0_3_0.md
@@ -186,6 +188,8 @@ files:
186
188
  - doc/release_notes/0_23_0.md
187
189
  - doc/release_notes/0_23_1.md
188
190
  - doc/release_notes/0_23_2.md
191
+ - doc/release_notes/0_23_3.md
192
+ - doc/release_notes/0_23_4.md
189
193
  - doc/release_notes/0_2_0.md
190
194
  - doc/release_notes/0_2_1.md
191
195
  - doc/release_notes/0_3_0.md
@@ -273,6 +277,7 @@ files:
273
277
  - lib/httpx/plugins/push_promise.rb
274
278
  - lib/httpx/plugins/rate_limiter.rb
275
279
  - lib/httpx/plugins/response_cache.rb
280
+ - lib/httpx/plugins/response_cache/file_store.rb
276
281
  - lib/httpx/plugins/response_cache/store.rb
277
282
  - lib/httpx/plugins/retries.rb
278
283
  - lib/httpx/plugins/stream.rb