lib/pitchfork/tee_input.rb in pitchfork-0.12.0 vs lib/pitchfork/tee_input.rb in pitchfork-0.13.0

- old
+ new

@@ -1,6 +1,7 @@ # -*- encoding: binary -*- +# frozen_string_literal: true module Pitchfork # Acts like tee(1) on an input input to provide a input-like stream # while providing rewindable semantics through a File/StringIO backing # store. On the first pass, the input is only read on demand so your @@ -40,11 +41,11 @@ # this unless you are writing an HTTP server. def initialize(socket, request) # :nodoc: @len = request.content_length super @tmp = @len && @len <= @@client_body_buffer_size ? - StringIO.new("") : new_tmpio + StringIO.new.binmode : new_tmpio end # :call-seq: # ios.size => Integer # @@ -119,10 +120,10 @@ private # consumes the stream of the socket def consume! - junk = "" + junk = "".b nil while read(@@io_chunk_size, junk) end def tee(buffer) @tmp.write(buffer) if buffer