Since we are using a builtin template, we can be assured to have the
target file in place. Middleware renamed since it is bound directly to
the concept of handling 404s.
Users can now place custom error pages in static/error/<error_code>.html
e.g. static/error/404.html
If no custom page is found, a default plaintext describing the error is served.
I filed actix/actix-web#261 as per the maintaner's request while
working on #310.
Having looked at the issue this morning, it appeared there was an
implementation to convert `io::Result` into a `Responder`, which kicked
in when I tried to access the `respond_to()` method without getting the
inner type from that first result before hand.
Conversion is by way of the `Display` trait impl since the actix errors
all seem to be more concerned with converting to/from http responses
rather than standard errors.
This implementation seems to match the behavior of the previous iron
server.
Static files are rendered as-is, and when a directory is requested, we
attempt to render a `index.html` found inside, or 404 if it's not
present.
The actix docs mention using channels to send a message to the server to
shut it down gracefully while running in another thread (as we're doing
here), but it seems like there would have to be some reorganization in
order to manage this effectively, perhaps holding the channel sender inside
`main.rs` so we can push a message through to the server when the call
to `cmd::serve()` finally returns.
For the time being, I left things without any careful attempts to
cleanup the server thread. This more or less matches the old iron
implementation as far as I can see.
The static file handling in actix is _just_ a little off from what we'd
want.
I left some comments in the source regarding why we can't just use their hook
for directory index redirection.