| Catalyst-ActionRole-RequireSSL documentation | Contained in the Catalyst-ActionRole-RequireSSL distribution. |
Catalyst::ActionRole::NoSSL - Force an action to be plain.
version 0.06
package MyApp::Controller::Foo;
use parent qw/Catalyst::Controller::ActionRole/;
sub bar : Local Does('RequireSSL') { ... }
sub bar : Local Does('NoSSL') { ... }
Simon Elliott <cpan@papercreatures.com>
Andy Grundman, <andy@hybridized.org> for the original RequireSSL Plugin
t0m (Tomas Doran), zamolxes (Bogdan Lucaciu)
Copyright 2009 by Simon Elliott
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-ActionRole-RequireSSL documentation | Contained in the Catalyst-ActionRole-RequireSSL distribution. |
package Catalyst::ActionRole::NoSSL; use Moose::Role; with 'Catalyst::ActionRole::RequireSSL::Role'; use namespace::autoclean; our $VERSION = '0.06';
around execute => sub { my $orig = shift; my $self = shift; my ($controller, $c) = @_; if($c->req->secure && $self->check_chain($c) && ( $c->req->method ne "POST" || $c->config->{require_ssl}->{ignore_on_post} )) { my $uri = $c->req->uri; $uri->scheme('http'); $c->res->redirect( $uri ); $c->detach(); } else { $self->$orig( @_ ); } }; 1;