Revision history for Perl extension Catalyst::Plugin::RequireSSL
-0.06
- - Fixed to support additional HTTP engines.
+0.06 2007-03-06 11:00:00
+ - Added no_cache config option to support wildcard SSL certificates.
+ (Simon Elliott)
+ - Disable properly when running under other development HTTP servers.
0.05 2005-09-15 12:15:00
- Updated skipped tests to run if Catalyst >= 5.5.
---
name: Catalyst-Plugin-RequireSSL
-version: 0.05
+version: 0.06
author:
- 'Andy Grundman, <andy@hybridized.org>'
abstract: Force SSL mode on select pages
license: perl
+resources:
+ license: http://dev.perl.org/licenses/
requires:
Catalyst: 5.23
provides:
Catalyst::Plugin::RequireSSL:
file: lib/Catalyst/Plugin/RequireSSL.pm
- version: 0.05
-generated_by: Module::Build version 0.2611
+ version: 0.06
+generated_by: Module::Build version 0.2806
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
# Save this 'cause CPAN will chdir all over the place.
my $cwd = Cwd::cwd();
- my $makefile = File::Spec->rel2abs($0);
- CPAN::Shell->install('Module::Build::Compat')
- or die " *** Cannot install without Module::Build. Exiting ...\n";
+ CPAN::Shell->install('Module::Build::Compat');
+ CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
+ or die "Couldn't install Module::Build, giving up.\n";
chdir $cwd or die "Cannot chdir() back to $cwd: $!";
}
eval "use Module::Build::Compat 0.02; 1" or die $@;
- use lib '_build/lib';
+
Module::Build::Compat->run_build_pl(args => \@ARGV);
require Module::Build;
Module::Build::Compat->write_makefile(build_class => 'Module::Build');
# disable the plugin when running under certain engines which don't
# support SSL
- # XXX: I didn't include Catalyst::Engine::Server here as it may be used as
- # a backend in a proxy setup.
if ( $c->engine =~ /Catalyst::Engine::HTTP/ ) {
$c->config->{require_ssl}->{disabled} = 1;
$c->log->warn( "RequireSSL: Disabling SSL redirection while running "
}
}
$redir .= '?' . join( '&', @params );
- }
- if($c->config->{require_ssl}->{'no_cache'}) {
- $c->config->{require_ssl}->{$type} = undef;
+ }
+
+ if ( $c->config->{require_ssl}->{no_cache} ) {
+ delete $c->config->{require_ssl}->{$type};
}
+
return $redir;
}
no_cache
If you have a wildcard certificate you will need to set this option if you are
-using multiple domains on one instance of catalyst.
+using multiple domains on one instance of Catalyst.
=head1 METHODS
--- /dev/null
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 4;
+use Catalyst::Test 'TestApp';
+
+TestApp->config->{require_ssl} = {
+ no_cache => 1,
+};
+
+# test an SSL redirect
+ok( my $res = request('http://localhost/ssl/secured'), 'request ok' );
+is( $res->code, 302, 'redirect code ok' );
+is( $res->header('location'), 'https://localhost/ssl/secured', 'redirect uri ok' );
+
+# test that the http/https server info wasn't cached
+ok( !TestApp->config->{https}, 'domain was not cached' );
\ No newline at end of file