class Cucumber::Formatter::IOHTTPBuffer

def send_content(uri, method, headers, attempts_remaining = 10)

def send_content(uri, method, headers, attempts_remaining = 10)
  content = (method == 'GET' ? StringIO.new : @write_io)
  http = build_client(uri)
  raise StandardError, "request to #{uri} failed (too many redirections)" if attempts_remaining <= 0
  request = build_request(uri, method, headers.merge('Content-Length' => content.size.to_s))
  content.rewind
  request.body_stream = content
  begin
    response = http.request(request)
  rescue SystemCallError
    # We may get the redirect response before pushing the file.
    response = http.request(build_request(uri, method, headers))
  end
  case response
  when Net::HTTPAccepted
    send_content(URI(response['Location']), 'PUT', {}, attempts_remaining - 1) if response['Location']
  when Net::HTTPRedirection
    send_content(URI(response['Location']), method, headers, attempts_remaining - 1)
  end
  response
end