class Rack::Multipart::Parser

def handle_fast_forward

with the opening boundary beyond the buffer size for that to happen.
boundary. The client would have to deliberately craft a response
and retry. It's highly unlikely the initial read will not consume the
boundary in that case. If no boundary found, we need to keep reading data
boundary, this is an invalid multipart upload, but keep scanning for opening
boundary, then we can transition to the next state. If we find the ending
This handles the initial parser state. We read until we find the starting
def handle_fast_forward
  while true
    case consume_boundary
    when :BOUNDARY
      # found opening boundary, transition to next state
      @state = :MIME_HEAD
      return
    when :END_BOUNDARY
      # invalid multipart upload
      if @sbuf.pos == @end_boundary_size && @sbuf.rest == EOL
        # stop parsing a buffer if a buffer is only an end boundary.
        @state = :DONE
        return
      end
      # retry for opening boundary
    else
      # no boundary found, keep reading data
      return :want_read
    end
  end
end