def send_file(resource, env)
      file     = ::Rack::File.new nil
      path     = resource.file_descriptor[:full_path]
      if !file.respond_to?(:path=)
        request  = ::Rack::Request.new(env)
        response = file.serving(request, path)
      else
        file.path = path
        response = file.serving(env)
      end
      status = response[0]
      response[1]['Content-Encoding'] = 'gzip' if %w[.svgz .gz].include?(resource.ext)
      # Do not set Content-Type if status is 1xx, 204, 205 or 304, otherwise
      # Rack will throw an error (500)
      if !(100..199).cover?(status) && ![204, 205, 304].include?(status)
        response[1]['Content-Type'] = resource.content_type || (resource.binary? ? 'application/octet-stream' : 'text/plain')
      end

      halt response
    end
def send_file(resource, env)
      file     = ::Rack::File.new nil
      path     = resource.file_descriptor[:full_path]
      if !file.respond_to?(:path=)
        request  = ::Rack::Request.new(env)
        response = file.serving(request, path)
      else
        file.path = path
        response = file.serving(env)
      end
      status = response[0]
      response[1]['Content-Encoding'] = 'gzip' if %w[.svgz .gz].include?(resource.ext)
      # Do not set Content-Type if status is 1xx, 204, 205 or 304, otherwise
      # Rack will throw an error (500)
      if !(100..199).cover?(status) && ![204, 205, 304].include?(status)
        response[1]['Content-Type'] = resource.content_type || (resource.binary? ? 'application/octet-stream' : 'text/plain')
      end

      halt response
    end
Immediately send static file