So I tried to look at the source of the test that failed, and I'm
not sure I even understand what it is doing. Here's the actual error
message I'm getting:
t/02pod................skipped: set TEST_POD to enable this test
t/03podcoverage........skipped: Test::Pod::Coverage 1.04 required
# Failed test 'redirect uri ok'
# at t/04ssl.t line 43.
# got: 'http://localhost:443/ssl/unsecured'
# expected: 'http://localhost/ssl/unsecured'
# Failed test 'redirect with params ok'
# at t/04ssl.t line 47.
# got: 'http://localhost:443/ssl/unsecured?a=1&a=2&b=3&c=4'
# expected: 'http://localhost/ssl/unsecured?a=1&a=2&b=3&c=4'
# Looks like you failed 2 tests of 15.
t/04ssl................ Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/15 subtests
The top error came from:
40 # test redirect back to http mode
41 ok( $res = request('https://localhost/ssl/unsecured'),
'request ok' );
42 is( $res->code, 302, 'redirect back to http ok' );
43 is( $res->header('location'),
'http://localhost/ssl/unsecured', 'redirect uri ok' );
So I'm guessing that line #41 is trying to request a secure action
that would normally redirect you back to an insecure place. This
jives, because it is requesting an HTTPS URL. However, If I am
right, then why is it considered a failure to end up on a non-secure
URL? I guess I don't understand what these tests are doing.
Those don't make sense to anyone else, either, right? I mean, if you
are going to request a URL from port 443,
Dustin Suchter wrote:
So I like the idea of the plugin, but I'm having a hard time installing
it. I found one hit on the Internet that with a report of someone else
having the exact same problem as me, but I don't see the solution online:http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.html
Byron Young wrote:
From: Dustin Suchter
Sent: Wednesday, March 26, 2008 1:13 PM
To: The elegant MVC web framework
Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect
Let's say I want to send people back and forth between an HTTP
connection and an HTTPS connection on a server based on some
example, clicking on a "logout" button from within my application
connected via HTTPS does something like:
The above seems like a fine solution except it totally disregards
beauty of uri_for, which I would love to be using for stuff like
Without uri_for, problems arise when you do things like test via
built in Perl webserver (the one running on port 3000 by default)
on the same webserver as my "production" application.
So the real question is, how do I properly refer to my webserver
application root and include port or SSL flags? I guess I'm looking
something like $0 within uri_for.
There's actually a neat plugin for doing this called
Catalyst::Plugin::RequireSSL. You just include it in your plugins and
then call $c->require_ssl() at the top of any actions you want to use
SSL for. It will disable itself automatically on the test server, too.
Dev site: http://dev.catalyst.perl.org/