rack-proxy 2.0.0 → 2.0.2

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: 88f01b57aeb1ef7de9f30b8b942b5c9a9721e67ebff64ff485e3a20fc00a3486
4
+ data.tar.gz: 850185d8f6c04de898dbab0e6c7b915de8b4947c1390ebc211d84986518982d3
5
5
  SHA512:
6
- metadata.gz: 1b0cbe8b0bb1e23edba280b7be30259fb347f51f4c415b1f33b3052fafbd9ceeb886ee3b60a1ac2bedd4bee98730693e77ada746894dd427ed967d1aa62bae8f
7
- data.tar.gz: ff6513f7e571fc101ace25a01fc81e14251e23b5fc6c11b44089c754384b0462d620f95b38324cfe9e888fd86390fd85beb3a416f85644cf5cc5f08d0011c292
6
+ metadata.gz: 64d65f0c275b8ae4f2239c47ced8ca7ccb60d703d4d09041ab8b5b2cdb0dda780d9ead1763e9817deb52a34e5f858ff35933dec8251518ce3b78a722e51983d7
7
+ data.tar.gz: fa4951bd080321917afb00da47e5884fb4454b25d63f8579c6aebb787f7b62d395b6b0b0c498d4262755ea6720139d9206e40ec16d6d6a3cd1f906bfe1731983
data/CHANGELOG.md CHANGED
@@ -8,6 +8,23 @@ follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
9
  Nothing yet.
10
10
 
11
+ ## [2.0.2] - 2026-11-19
12
+
13
+ ### Fixed
14
+
15
+ - The bounded request body stream no longer passes a `nil` output buffer on to
16
+ `rack.input#read`, which Rack 3's `Rack::Lint` rejects, when it is read
17
+ without one. (#148)
18
+
19
+ ## [2.0.1] - 2026-09-16
20
+
21
+ ### Fixed
22
+
23
+ - The bounded request body stream accepts `IO#read`'s optional `length`
24
+ argument. Net::HTTP instrumentation layers that read the whole request body
25
+ at once (WebMock's adapter, for example) raised `ArgumentError` against
26
+ 2.0.0, failing the test suite of any app that proxies a request body. (#145)
27
+
11
28
  ## [2.0.0] - 2026-09-05
12
29
 
13
30
  ### Breaking changes
@@ -238,7 +255,9 @@ or a compatible fix. See the README's "Upgrading" section for migration steps.
238
255
 
239
256
  Older releases (≤ 0.7.8) predate this changelog; see the git history and tags.
240
257
 
241
- [Unreleased]: https://github.com/ncr/rack-proxy/compare/v2.0.0...HEAD
258
+ [Unreleased]: https://github.com/ncr/rack-proxy/compare/v2.0.2...HEAD
259
+ [2.0.2]: https://github.com/ncr/rack-proxy/compare/v2.0.1...v2.0.2
260
+ [2.0.1]: https://github.com/ncr/rack-proxy/compare/v2.0.0...v2.0.1
242
261
  [2.0.0]: https://github.com/ncr/rack-proxy/compare/v1.0.2...v2.0.0
243
262
  [1.0.2]: https://github.com/ncr/rack-proxy/compare/v1.0.1...v1.0.2
244
263
  [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.2"
6
6
  end
7
7
  end
data/lib/rack/proxy.rb CHANGED
@@ -46,18 +46,35 @@ 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
53
55
  end
54
56
 
57
+ # a read buffer cannot be nil; make a new empty buffer
58
+ buffer ||= +"".b
55
59
  data = @input.read([length, @remaining].min, buffer)
56
60
  raise InvalidRequest, "request body is shorter than Content-Length" if data.nil? || data.empty?
57
61
 
58
62
  @remaining -= data.bytesize
59
63
  data
60
64
  end
65
+
66
+ private
67
+
68
+ # IO#read without a length returns everything up to EOF ("" once there).
69
+ # Net::HTTP never calls it that way, but instrumentation layers wrapping
70
+ # Net::HTTP#request (WebMock's adapter, for one) do.
71
+ def read_remaining(buffer)
72
+ data = +"".b
73
+ while (chunk = read(16_384))
74
+ data << chunk
75
+ end
76
+ buffer ? buffer.replace(data) : data
77
+ end
61
78
  end
62
79
  private_constant :InvalidRequest, :RequestBodyStream
63
80
 
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.2
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-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack