Skip to content

Do not rewind unrewindable IOs #531

@ixti

Description

@ixti

Reported by @mikker:


We're using IO.pipe for chunked POST requests in @elastic's APM Agent and I'm stubbing away rewind on my reader objects because of this.

# HTTP.rb calls #rewind the body stream which IO.pipes don't support
class ModdedIO < IO
  def self.pipe(ext_enc = nil)
    super(ext_enc).tap do |rw|
      rw[0].define_singleton_method(:rewind) { nil }
    end
  end
end

Just wanted to provide an actual use of IO.pipe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions