| 1 | package Catalyst::ActionRole::NoSSL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | with 'Catalyst::ActionRole::RequireSSL::Role'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '0.07'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | Catalyst::ActionRole::NoSSL - Force an action to be plain. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | version 1.00 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | package MyApp::Controller::Foo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | use parent qw/Catalyst::Controller::ActionRole/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | sub bar : Local Does('RequireSSL') { ... } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | sub bar : Local Does('NoSSL') { ... } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 7 | ▶ | around execute => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 7 | my $orig = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 7 | my ($controller, $c) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 7 | ▶ | if($c->req->secure && $self->check_chain($c) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$c->req->secure and $self->check_chain($c) and $c->req->method ne "POST" || $c->config->{"require_ssl"}{"ignore_on_post"}
$c->req->secure and $self->check_chain($c)
$c->req->method ne "POST" or $c->config->{"require_ssl"}{"ignore_on_post"}
MC/DC50%2/4
$c->req->secure and $self->check_chain($c) and $c->req->method ne "POST" || $c->config->{"require_ssl"}{"ignore_on_post"}
$c->req->secure
$self->check_chain($c)
$c->req->method ne "POST"
$c->config->{"require_ssl"}{"ignore_on_post"}
Truth table60%3/5
A and B and C or D
A= $c->req->secureB= $self->check_chain($c)C= $c->req->method ne "POST"D= $c->config->{"require_ssl"}{"ignore_on_post"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ( $c->req->method ne "POST" || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | $c->config->{require_ssl}->{ignore_on_post} )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | my $uri = $c->req->uri->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | $uri->scheme('http'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | $c->res->redirect( $uri, 301 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | $c->detach(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | $self->$orig( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | Simon Elliott <cpan@papercreatures.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | =head1 THANKS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | Andy Grundman, <andy@hybridized.org> for the original RequireSSL Plugin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | t0m (Tomas Doran), zamolxes (Bogdan Lucaciu) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | Copyright 2009 by Simon Elliott | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | This program is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||