Jifty

 view release on metacpan or  search on metacpan

lib/Jifty/Handler.pm  view on Meta::CPAN

        )->to_app
    );

    for ( grep { defined $_ } map { $_->psgi_app_static } Jifty->plugins ) {
        $static->add( $_ );
    }

    $static->add( Plack::App::File->new
            ( root => Jifty->config->framework('Web')->{DefaultStaticRoot} )->to_app );

    # the buffering and unsetting of psgi.streaming is to vivify the
    # responded res from the $static cascade app.
    builder {
        enable 'Plack::Middleware::ConditionalGET';
        enable
            sub { my $app = shift;
                  sub { my $env = shift;
                        $env->{'psgi.streaming'} = 0;
                        my $res = $app->($env);
                        # skip streamy response
                        return $res unless ref($res) eq 'ARRAY' && $res->[2];
                        my $h = Plack::Util::headers($res->[1]);;
                        $h->set( 'Cache-Control' => 'max-age=31536000, public' );
                        $h->set( 'Expires' => HTTP::Date::time2str( time() + 31536000 ) );
                        $res;
                    };
              };
        enable 'Plack::Middleware::BufferedStreaming';



( run in 0.246 second using v1.01-cache-2.11-cpan-4d50c553e7e )