NAME
    Catalyst::Plugin::XSendFile - Catalyst plugin for lighttpd's X-Sendfile.

SYNOPSIS
        use Catalyst qw/XSendFile/;
        
    sub show : Path('/files') {
            my ( $self, $c, $filename ) = @_;
        
        # unless login, it shows 403 forbidden screen
            $c->res->status(403);
            $c->stash->{template} = 'error-403.tt';
        
        # serving a static file only when user logged in.
            if ($c->user) {
                $c->res->sendfile( "/path/to/$filename" );
            }
        }

DESCRIPTION
    lighty's X-Sendfile feature is great.

    If you use lighttpd + fastcgi, you can show files only set X-Sendfile
    header like below:

        $c->res->header( 'X-LIGHTTPD-send-file' => $filename );

    This feature is especially great for serving static file on
    authentication area.

    And with this plugin, you can use:

        $c->res->sendfile( $filename );

    instead of above.

    But off-course you know, this feature doesn't work on Catalyst Test
    Server (myapp_server.pl). So this module also provide its emulation when
    your app on test server.

SEE ALSO
    lighty's life - X-Sendfile
    http://blog.lighttpd.net/articles/2006/07/02/x-sendfile

NOTICE
    To use it you have to set "allow-x-sendfile" option enabled in your
    fastcgi configuration.

        "allow-x-send-file" => "enable",

EXTENDED_METHODS
  setup
    Setup MIME::Types object unless Static::Simple loaded.

  finalize_headers
    Added X-Sendfile emulation feature for test server.

EXTENDED_RESPONSE_METHODS
  sendfile
    Set X-LIGHTTPD-send-file header easily.

AUTHOR
    Daisuke Murase <typester@cpan.org>

COPYRIGHT
    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

    The full text of the license can be found in the LICENSE file included
    with this module.