Struct hyper_staticfile::Static [] [src]

pub struct Static<U = DefaultUpstream> { /* fields omitted */ }

A Hyper service implementing static file serving.

This service serves files from a single filesystem path, which may be absolute or relative. Incoming requests are mapped onto the filesystem by appending their URL path to the service root path. If the filesystem path corresponds to a regular file, the service will attempt to serve it. Otherwise, if the path corresponds to a directory containing an index.html, the service will attempt to serve that instead.

If the path doesn't match any real object in the filesystem, the service will call the optional upstream service, or respond with 404. Permission errors always result in a 403 response.

Only GET and HEAD requests are handled. Requests with a different method are passed to the optional upstream service, or responded to with 400.

If an IO error occurs whilst attempting to serve a file, hyper::Error(Io) will be returned.

Methods

impl<U> Static<U>
[src]

Create a new instance of Static with a given root path and upstream.

If Path::new("") is given, files will be served from the current directory.

Add cache headers to responses for the given duration.

impl Static<DefaultUpstream>
[src]

Create a new instance of Static with a given root path.

If Path::new("") is given, files will be served from the current directory.

Trait Implementations

impl<U: Clone> Clone for Static<U>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<U> Service for Static<U> where
    U: Service<Request = Request, Response = Response, Error = Error, Future = Box<Future<Item = Response, Error = Error>>>, 
[src]

Requests handled by the service.

Responses given by the service.

Errors produced by the service.

The future response value.

Process the request and return the response asynchronously.