Dancer2

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      configuration change, which works. (Sawyer X)
    * GH #578: Remove the default engine configurations. (Sawyer X)
    * GH #567: Check for proper module names in loading engines. Might help
      with taint mode. (Sawyer X)
    * GH #585, #595: Return 405 Method Not Allowed instead of 500.
      (Omar M. Othman)
    * GH #570, #579: Ensure keywords pass, send_error and send_file
      exit immediately when executed. (Russell Jenkins)

    [ ENHANCEMENTS ]
    * GH #587: Serializer::Mutable alive! (Pedro Bruno)

    [ DOCUMENTATION ]
    * Fix doc for params(). Ported from Dancer#1025 (Stefan Hornburg)

0.140001  2014-05-01 10:49:25CEST+0200 Europe/Amsterdam

    [ BUG FIXES ]
    * Bugfix for extracting multiple cookies within a request.
      (Cymon, Russell Jenkins)
    * Require minimum version of Plack to make sure we can add the Head

lib/Dancer2/Core/Request.pm  view on Meta::CPAN

use Dancer2::Core::Request::Upload;
use Dancer2::Core::Cookie;

# add an attribute for each HTTP_* variables
# (HOST is managed manually)
my @http_env_keys = (qw/
    accept_charset
    accept_encoding
    accept_language
    connection
    keep_alive
    x_requested_with
/);

# apparently you can't eval core functions
sub accept { $_[0]->env->{'HTTP_ACCEPT'} }

eval << "_EVAL" or die $@ for @http_env_keys; ## no critic
sub $_ { \$_[0]->env->{ 'HTTP_' . ( uc "$_" ) } }
1;
_EVAL

lib/Dancer2/Core/Request.pm  view on Meta::CPAN


=item C<host>

Checks whether we are behind a proxy using the C<behind_proxy>
configuration option, and if so returns the first
C<HTTP_X_FORWARDED_HOST>, since this is a comma separated list.

If you have not configured that you are behind a proxy, it returns HTTP
header C<HTTP_HOST>.

=item C<keep_alive>

HTTP header: C<HTTP_KEEP_ALIVE>.

=item C<referer>

HTTP header: C<HTTP_REFERER>.

=item C<user_agent>

HTTP header: C<HTTP_USER_AGENT>.

lib/Dancer2/Manual/Deployment.pod  view on Meta::CPAN


=head2 Using Gazelle

L<Gazelle|https://metacpan.org/pod/Gazelle> is another PSGI server that
focuses on long-lived connections and minimal overhead.

Run your app with Gazelle like this:

    plackup -s Gazelle -p 5000 bin/app.psgi

Gazelle provides options for optimizing keep-alive connections and
handling large numbers of requests efficiently.

=head2 Using Server::Starter for Zero-Downtime Deployments

L<Server::Starter> provides you with a superdaemon and instance script
for managing PSGI-based Perl application servers. The superdaemon is
responsible for starting new processes and shutting down old ones. It
provides hot-deployment capability by watching for restart requests and
ensuring new processes successfully start up before terminating the old
processes. F<start_server> is the command-line program that allows you

t/classes/Dancer2-Core-Request/new.t  view on Meta::CPAN

        my $env     = shift;
        my $request = Dancer2::Core::Request->new( env => $env );
        isa_ok( $request, 'Dancer2::Core::Request' );

        can_ok( $request, 'env' );
        isa_ok( $request->env, 'HASH' );

        # http env keys
        my @http_env_keys = qw<
            accept accept_charset accept_encoding accept_language
            connection keep_alive referer user_agent x_requested_with
        >;

        can_ok( $request, @http_env_keys );

        is(
            $request->$_,
            $request->env->{"HTTP_$_"},
            "HTTP ENV key $_",
        ) for @http_env_keys;

t/forward.t  view on Meta::CPAN

      { method => 'post' };
};
get '/proxy/' => sub {
    return uri_for('/');
};
get '/forward_with_proxy/' => sub {
    forward '/proxy/';
};

# NOT SUPPORTED IN DANCER2
# In dancer2, vars are alive for only one request flow, a forward initiate a
# new request flow, then the vars HashRef is destroyed.
#
# get '/b' => sub { vars->{test} = 1;  forward '/a'; };
# get '/a' => sub { return "test is " . var('test'); };

my $app = __PACKAGE__->to_app;
ok( is_coderef($app), 'Got app' );

test_psgi $app, sub {
    my $cb = shift;



( run in 2.102 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )