-
-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Describe the bug
Hello,
We encountered an Illegal seek (Errno::ESPIPE) exception while doing some chunked transfer encoding with a pipe-io as body.
The exception is raised when the body is rewinded. While a pipe-io responses to rewind it actually can't be rewinded.
httplog/lib/httplog/adapters/http.rb
Line 37 in ae519ee
| body.rewind if body.respond_to?(:rewind) |
In the source of the http.rb gem is a comment as to what happens when rewind is called on a pipe-io. Maybe that explains it a little better. :) https://github.com/httprb/http/blob/a0f540ffd03b29bf35bd5476b82a20fb8c3b88b8/lib/http/request/body.rb#L57
Steps to reproduce
require 'http'
require 'httplog'
rd, wr = IO.pipe
wr.write('a chunk')
wr.close
HTTP.post('https://www.sumcumo.com', body: rd, headers: { 'Transfer-Encoding' => 'chunked' })Expected behavior
Don't raise an exception while chunked transfer encoding with pipe-io as body is used.
Environment
- Ruby version: 2.7.2
- httplog version: 1.4.3
- http version: 4.4.1
Have a great day! :)
Eric
Metadata
Metadata
Assignees
Labels
No labels