[Catalyst] Usage of $c->uri_for and $c->res->redirect
dsuchter at ucla.edu
Thu Apr 3 02:15:25 BST 2008
I'm pretty sure they are false negatives too. I'll try a force
install and see how it goes when I start actually using the plugin.
Byron Young wrote:
>> -----Original Message-----
>> From: Dustin Suchter [mailto:dsuchter at ucla.edu]
>> Sent: Wednesday, April 02, 2008 5:44 PM
>> To: The elegant MVC web framework
>> Subject: Re: [Catalyst] Usage of $c->uri_for and $c->res->redirect
>> 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
>> 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:
>> # 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-
>> 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
>> are going to request a URL from port 443,
> Heh, you know, I think I force installed that plugin because those test results looked like false negatives. It has been working fine for me, though. I probably should have investigated it more, but I just went with it and never looked back. I'm going to be installing a bunch of the catalyst modules on another server this week, so I'll let you know if I run into the same thing again, and I'll try to look into it if I have time.
>> Dustin Suchter wrote:
>>> So I like the idea of the plugin, but I'm having a hard time
>>> it. I found one hit on the Internet that with a report of someone
>>> having the exact same problem as me, but I don't see the solution
>>> Any ideas?
>>> Byron Young wrote:
>>>>> -----Original Message-----
>>>>> From: Dustin Suchter [mailto:dsuchter at ucla.edu]
>>>>> 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
>>>>> action. For
>>>>> example, clicking on a "logout" button from within my
>>>>> connected via HTTPS does something like:
>>>>> The above seems like a fine solution except it totally
>>>>> beauty of uri_for, which I would love to be using for stuff
>>>>> Without uri_for, problems arise when you do things like test
>>>>> built in Perl webserver (the one running on port 3000 by
>>>>> on the same webserver as my "production" application.
>>>>> So the real question is, how do I properly refer to my
>>>>> application root and include port or SSL flags? I guess I'm
>>>>> something like $0 within uri_for.
>>>> Hey Dustin,
>>>> 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.
>>>> List: Catalyst at lists.scsys.co.uk
>>>> Listinfo: http://lists.scsys.co.uk/cgi-
>>>> Searchable archive:
>>>> Dev site: http://dev.catalyst.perl.org/
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-
>> Searchable archive: http://www.mail-
>> archive.com/catalyst at lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://email@example.com/
> Dev site: http://dev.catalyst.perl.org/
More information about the Catalyst