When request.env["rack.input"] is passed through to a Net::HTTP request as the body, copy_stream is called on it, which throws an exception:
3.86s error: Protocol::Rack::Adapter::Rack2: Reading HTTP/1.1 requests for Async::HTTP::Protocol::HTTP1::Server. [oid=0x2648] [ec=0x265c] [pid=1611996] [2024-08-21 11:22:02 +1200]
| ArgumentError: wrong number of arguments
| → .../gems/protocol-http-0.28.1/lib/protocol/http/body/stream.rb:114 in `readpartial'
| .../ruby/3.3.0/net/http/generic_request.rb:282 in `copy_stream'
| .../ruby/3.3.0/net/http/generic_request.rb:282 in `send_request_with_body_stream'
| .../ruby/3.3.0/net/http/generic_request.rb:202 in `exec'
| .../ruby/3.3.0/net/http.rb:2335 in `block in transport_request'
| .../ruby/3.3.0/net/http.rb:2333 in `catch'
| .../ruby/3.3.0/net/http.rb:2333 in `transport_request'
| .../ruby/3.3.0/net/http.rb:2306 in `request'
Ran into this when trying to stream request bodies to an S3 put request.
When
request.env["rack.input"]
is passed through to aNet::HTTP
request as the body,copy_stream
is called on it, which throws an exception:Ran into this when trying to stream request bodies to an S3
put
request.Reproduction repo: https://github.com/madleech/hanami-streaming-uploads