class Rack::Multipart::Parser::Collector

def check_part_limits

def check_part_limits
  file_limit = Utils.multipart_file_limit
  part_limit = Utils.multipart_total_part_limit
  if file_limit && file_limit > 0
    if @open_files >= file_limit
      @mime_parts.each(&:close)
      raise MultipartPartLimitError, 'Maximum file multiparts in content reached'
    end
  end
  if part_limit && part_limit > 0
    if @mime_parts.size >= part_limit
      @mime_parts.each(&:close)
      raise MultipartTotalPartLimitError, 'Maximum total multiparts in content reached'
    end
  end
end