Class

Rack::File

Inheritance
< Object

Rack::File serves files below the root given, according to the path info of the Rack request.

Handlers can detect if bodies are a Rack::File, and use mechanisms like sendfile on the path.

Constants

Name   Description
F = ::File

Attributes

Name Visibility R/W Description
path public RW
root public RW

Aliases

Method Alias Description
path → to_path

Methods

Class

Visibility Signature
public new (root)

Instance

Visibility Signature
public _call (env)
public call (env)
public each () {|part| ...}
public forbidden ()
public not_found ()
public serving ()

Class Method Detail

new(root)

Instance Method Detail

_call(env)

call(env)

each() {|part| ...}

forbidden()

not_found()

serving()

NOTE:

  We check via File::size? whether this file provides size info
  via stat (e.g. /proc files often don't), otherwise we have to
  figure it out by reading the whole file into memory. And while
  we're at it we also use this as body then.