Provide convenience method to deliver files with X-Sendfile, X-Accel-Redirect, ...
Perl
Pull request Compare This branch is 5 commits behind davewood:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/Catalyst/TraitFor/Controller
t
.gitignore
CHANGES
Makefile.PL
README

README

NAME
    Catalyst::TraitFor::Controller::Sendfile - convenience method to send
    files with X-Sendfile, X-Accel-Redirect, ...

SYNOPSIS
        package MyApp::Controller::Foo;
        use Moose;
        use Path::Class qw/ file /;
        use namespace::autoclean;

        BEGIN { extends 'Catalyst::Controller' }
        with 'Catalyst::TraitFor::Controller::Sendfile';

        __PACKAGE__->config(sendfile_header => 'X-Sendfile');

        sub some_action : Local {
            my ($self, $c) = @_;
            $self->sendfile($c, file(qw/ path to file/));
        }

DESCRIPTION
    If you want to deliver files using headers like 'X-Sendfile' or
    'X-Accel-Redirect' you can apply this trait and use its convenience
    method sendfile.

ATTRIBUTES
  sendfile_header
    name of the Sendfile header. Defaults to X-Sendfile (apache mod_sendfile
    and lighttpd), or should be changed to 'X-Accel-Redirect' for nginx

  sendfile
    You call sendfile with $c and a Path::Class::File object. The file path
    can't be seen by the client. Your webserver should check if the
    'X-Sendfile' header is set and if so deliver the file.

AUTHORS
    David Schmidt (davewood) "<davewood@gmx.at>"

    Florian Ragwitz "<rafl@debian.org>"

    Tomas Doran (t0m) "<bobtfish@bobtfish.net>"

COPYRIGHT
    Copyright (c) 2010, the above named authors.

LICENSE
    This library is free software. You can redistribute it and/or modify it
    under the same terms as Perl itself.