rack-proxy 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b7446fb448e8e91e1fbc8a052fc170901649bcb3df26fbabf7741ca5b331449
4
- data.tar.gz: c87d52a7ebe5e144e9254e84ebae969f3b8f4fed74c79483ce89ae9075e2b547
3
+ metadata.gz: 12583aa295312c50b4133259be96749c8cb515eca735f3df803008970f5f941a
4
+ data.tar.gz: 765f25cc8fef13acb7b0276ed7d193d35c3ad91acc00074b923b2f1558e384d8
5
5
  SHA512:
6
- metadata.gz: 1b0cbe8b0bb1e23edba280b7be30259fb347f51f4c415b1f33b3052fafbd9ceeb886ee3b60a1ac2bedd4bee98730693e77ada746894dd427ed967d1aa62bae8f
7
- data.tar.gz: ff6513f7e571fc101ace25a01fc81e14251e23b5fc6c11b44089c754384b0462d620f95b38324cfe9e888fd86390fd85beb3a416f85644cf5cc5f08d0011c292
6
+ metadata.gz: 2f6467276179125820219ff0f553f216dced29a36d0a14e60d03ab5e86e49b06ab601f47f25bbc5aa180cb11be9358a3689137fbe7ff6c6190626d171b80ab92
7
+ data.tar.gz: e8f825b48982e015dedb923dc6bd21c7d7144ec991b9c8e24a65c2d9755daec0bc86df9519c045c9d8689bb0b1c4693966b609a66d6958d77edfd1b4fe016227
data/CHANGELOG.md CHANGED
@@ -8,6 +8,15 @@ follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
9
  Nothing yet.
10
10
 
11
+ ## [2.0.1] - 2026-09-16
12
+
13
+ ### Fixed
14
+
15
+ - The bounded request body stream accepts `IO#read`'s optional `length`
16
+ argument. Net::HTTP instrumentation layers that read the whole request body
17
+ at once (WebMock's adapter, for example) raised `ArgumentError` against
18
+ 2.0.0, failing the test suite of any app that proxies a request body. (#145)
19
+
11
20
  ## [2.0.0] - 2026-09-05
12
21
 
13
22
  ### Breaking changes
@@ -238,7 +247,8 @@ or a compatible fix. See the README's "Upgrading" section for migration steps.
238
247
 
239
248
  Older releases (≤ 0.7.8) predate this changelog; see the git history and tags.
240
249
 
241
- [Unreleased]: https://github.com/ncr/rack-proxy/compare/v2.0.0...HEAD
250
+ [Unreleased]: https://github.com/ncr/rack-proxy/compare/v2.0.1...HEAD
251
+ [2.0.1]: https://github.com/ncr/rack-proxy/compare/v2.0.0...v2.0.1
242
252
  [2.0.0]: https://github.com/ncr/rack-proxy/compare/v1.0.2...v2.0.0
243
253
  [1.0.2]: https://github.com/ncr/rack-proxy/compare/v1.0.1...v1.0.2
244
254
  [1.0.1]: https://github.com/ncr/rack-proxy/compare/v1.0.0...v1.0.1
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class Proxy
5
- VERSION = "2.0.0"
5
+ VERSION = "2.0.1"
6
6
  end
7
7
  end
data/lib/rack/proxy.rb CHANGED
@@ -46,7 +46,9 @@ module Rack
46
46
  @input, @remaining = input, length
47
47
  end
48
48
 
49
- def read(length, buffer = nil)
49
+ def read(length = nil, buffer = nil)
50
+ return read_remaining(buffer) if length.nil?
51
+
50
52
  if @remaining.zero?
51
53
  buffer&.clear
52
54
  return nil
@@ -58,6 +60,19 @@ module Rack
58
60
  @remaining -= data.bytesize
59
61
  data
60
62
  end
63
+
64
+ private
65
+
66
+ # IO#read without a length returns everything up to EOF ("" once there).
67
+ # Net::HTTP never calls it that way, but instrumentation layers wrapping
68
+ # Net::HTTP#request (WebMock's adapter, for one) do.
69
+ def read_remaining(buffer)
70
+ data = +"".b
71
+ while (chunk = read(16_384))
72
+ data << chunk
73
+ end
74
+ buffer ? buffer.replace(data) : data
75
+ end
61
76
  end
62
77
  private_constant :InvalidRequest, :RequestBodyStream
63
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacek Becela
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-05 00:00:00.000000000 Z
11
+ date: 2026-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack