X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FRequireSSL.pm;h=edf613fedc02095241da46679cd919a4aa602c55;hb=794abe2a200320318b087365f8141750a92f0647;hp=6aafbc46e01d8922c22aa5f0b13ac6b3d3cb007b;hpb=b67d920751ccd16137c8ff3d6e3216a89fce8d9b;p=catagits%2FCatalyst-Plugin-RequireSSL.git diff --git a/lib/Catalyst/Plugin/RequireSSL.pm b/lib/Catalyst/Plugin/RequireSSL.pm index 6aafbc4..edf613f 100644 --- a/lib/Catalyst/Plugin/RequireSSL.pm +++ b/lib/Catalyst/Plugin/RequireSSL.pm @@ -21,6 +21,7 @@ sub require_ssl { else { $c->_ssl_strip_output(1); $c->res->redirect( $redir ); + $c->detach if $c->config->{require_ssl}->{detach_on_redirect}; } } } @@ -134,6 +135,7 @@ Catalyst::Plugin::RequireSSL - Force SSL mode on select pages http => 'www.mydomain.com', remain_in_ssl => 0, no_cache => 0, + detach_on_redirect => 1, }; # in any controller methods that should be secured @@ -182,6 +184,13 @@ users will be redirected back to non-SSL mode as soon as possible. If you have a wildcard certificate you will need to set this option if you are using multiple domains on one instance of Catalyst. + detach_on_redirect + +By default C<< $c->require_ssl >> only calls C<< $c->response->redirect >> but +does not stop request processing (so it returns and subsequent statements are +run). This is probably not what you want. If you set this option to a true +value C<< $c->require_ssl >> will call C<< $c->detach >> when it redirects. + =head1 METHODS =head2 require_ssl