Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-04-02 Thread Dustin Suchter
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/01useok
t/02podskipped: set TEST_POD to enable this test
t/03podcoverageskipped: Test::Pod::Coverage 1.04 required
t/04ssl1/15
#   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=1a=2b=3c=4'
# expected: 'http://localhost/ssl/unsecured?a=1a=2b=3c=4'
# Looks like you failed 2 tests of 15.
t/04ssl Dubious, test returned 2 (wstat 512, 0x200)
 Failed 2/15 subtests
t/05ssl_host...ok
t/06remain_in_ssl..ok

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.


-d





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

Any ideas?

Byron Young wrote:

-Original Message-
From: Dustin Suchter [mailto:[EMAIL PROTECTED]
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 application
while
connected via HTTPS does something like:

$c-res-redirect(http://foo.com/;);

The above seems like a fine solution except it totally disregards
the
beauty of uri_for, which I would love to be using for stuff like
this.
Without uri_for, problems arise when you do things like test via
the
built in Perl webserver (the one running on port 3000 by default)
while
on the same webserver as my production application.

So the real question is, how do I properly refer to my webserver
and/or
application root and include port or SSL flags? I guess I'm looking
for
something like $0 within uri_for.

-d


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.


Cheers,
Byron

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

Dev site: http://dev.catalyst.perl.org/





___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-04-02 Thread Byron Young
 -Original Message-
 From: Dustin Suchter [mailto:[EMAIL PROTECTED]
 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
 error
 message I'm getting:

 t/01useok
 t/02podskipped: set TEST_POD to enable this test
 t/03podcoverageskipped: Test::Pod::Coverage 1.04 required
 t/04ssl1/15
 #   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=1a=2b=3c=4'
 # expected: 'http://localhost/ssl/unsecured?a=1a=2b=3c=4'
 # Looks like you failed 2 tests of 15.
 t/04ssl Dubious, test returned 2 (wstat 512, 0x200)
   Failed 2/15 subtests
 t/05ssl_host...ok
 t/06remain_in_ssl..ok

 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.

 -d





 Those don't make sense to anyone else, either, right? I mean, if
 you
 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.

Byron


 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
 
  Any ideas?
 
  Byron Young wrote:
  -Original Message-
  From: Dustin Suchter [mailto:[EMAIL PROTECTED]
  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
 application
  while
  connected via HTTPS does something like:
 
  $c-res-redirect(http://foo.com/;);
 
  The above seems like a fine solution except it totally
 disregards
  the
  beauty of uri_for, which I would love to be using for stuff
 like
  this.
  Without uri_for, problems arise when you do things like test
 via
  the
  built in Perl webserver (the one running on port 3000 by
 default)
  while
  on the same webserver as my production application.
 
  So the real question is, how do I properly refer to my
 webserver
  and/or
  application root and include port or SSL flags? I guess I'm
 looking
  for
  something like $0 within uri_for.
 
  -d
 
  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.
 
  Cheers,
  Byron
 
  ___
  List: Catalyst@lists.scsys.co.uk
  Listinfo: http://lists.scsys.co.uk/cgi-
 bin/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
  Dev site: http://dev.catalyst.perl.org/
 
 

 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-
 bin/mailman/listinfo/catalyst
 Searchable archive: http://www.mail-
 archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-04-02 Thread Dustin Suchter

Nice.

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.


-d

Byron Young wrote:

-Original Message-
From: Dustin Suchter [mailto:[EMAIL PROTECTED]
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
error
message I'm getting:

t/01useok
t/02podskipped: set TEST_POD to enable this test
t/03podcoverageskipped: Test::Pod::Coverage 1.04 required
t/04ssl1/15
#   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=1a=2b=3c=4'
# expected: 'http://localhost/ssl/unsecured?a=1a=2b=3c=4'
# Looks like you failed 2 tests of 15.
t/04ssl Dubious, test returned 2 (wstat 512, 0x200)
  Failed 2/15 subtests
t/05ssl_host...ok
t/06remain_in_ssl..ok

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.

-d





Those don't make sense to anyone else, either, right? I mean, if
you
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.

Byron



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

Any ideas?

Byron Young wrote:

-Original Message-
From: Dustin Suchter [mailto:[EMAIL PROTECTED]
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

application

while
connected via HTTPS does something like:

$c-res-redirect(http://foo.com/;);

The above seems like a fine solution except it totally

disregards

the
beauty of uri_for, which I would love to be using for stuff

like

this.
Without uri_for, problems arise when you do things like test

via

the
built in Perl webserver (the one running on port 3000 by

default)

while
on the same webserver as my production application.

So the real question is, how do I properly refer to my

webserver

and/or
application root and include port or SSL flags? I guess I'm

looking

for
something like $0 within uri_for.

-d

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.

Cheers,
Byron

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-

bin/mailman/listinfo/catalyst

Searchable archive:
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-
bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



___
List

Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-04-02 Thread Adam Herzog
On Thu, Mar 27, 2008 at 2:37 AM, Dustin Suchter [EMAIL PROTECTED] 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

The changelog for Catalyst-Runtime includes the following, for
v5.7011: Fixed bug where req-base and req-uri would include a port
number when running in SSL mode.

If you're running a version prior to 5.7011, try upgrading. If that
fixes the failing tests, then post back here. It may be the case that
the version requirement in RequireSSL just needs to be bumped.

-A

-- 
Adam Herzog
Email: [EMAIL PROTECTED]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-04-02 Thread Dustin Suchter

That seems to have fixed the problem. Excellent catch!

I had Catalyst::Runtime version 5.7010 so I used CPAN to upgrade 
that package which brought me up to 5.7012.


I don't know of a nice clean way to remove a package you've 
installed with CPAN, but it was easy enough to just run 'test 
Catalyst::Plugin::RequireSSL' and see that it passed test #4 this 
time around.


-d

Adam Herzog wrote:

On Thu, Mar 27, 2008 at 2:37 AM, Dustin Suchter [EMAIL PROTECTED] 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


The changelog for Catalyst-Runtime includes the following, for
v5.7011: Fixed bug where req-base and req-uri would include a port
number when running in SSL mode.

If you're running a version prior to 5.7011, try upgrading. If that
fixes the failing tests, then post back here. It may be the case that
the version requirement in RequireSSL just needs to be bumped.

-A



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-27 Thread Dustin Suchter
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

Any ideas?

Byron Young wrote:

-Original Message-
From: Dustin Suchter [mailto:[EMAIL PROTECTED]
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 application
while
connected via HTTPS does something like:

$c-res-redirect(http://foo.com/;);

The above seems like a fine solution except it totally disregards
the
beauty of uri_for, which I would love to be using for stuff like
this.
Without uri_for, problems arise when you do things like test via
the
built in Perl webserver (the one running on port 3000 by default)
while
on the same webserver as my production application.

So the real question is, how do I properly refer to my webserver
and/or
application root and include port or SSL flags? I guess I'm looking
for
something like $0 within uri_for.

-d


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.

Cheers,
Byron

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-26 Thread Dustin Suchter
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 application while 
connected via HTTPS does something like:


$c-res-redirect(http://foo.com/;);

The above seems like a fine solution except it totally disregards the 
beauty of uri_for, which I would love to be using for stuff like this. 
Without uri_for, problems arise when you do things like test via the 
built in Perl webserver (the one running on port 3000 by default) while 
on the same webserver as my production application.


So the real question is, how do I properly refer to my webserver and/or 
application root and include port or SSL flags? I guess I'm looking for 
something like $0 within uri_for.


-d

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-26 Thread Dustin Suchter
Can you directly control the port you redirect to? Part of my 
problem is having consistency between the production and test 
environments, which operate on 80/443 and 3000/3000 respectively.


-d

Ashley wrote:
There are two approaches which have helped me. Remember the URI object 
underneath can be your friend.


1) Keep things relative.
   $c-uri_for(/blah)-path
   $c-uri_for(/blah)-path_query

2) Change the scheme yourself.
   my $uri = $c-uri_for(/blah);
   $uri-scheme( $my_test ? http : https );

-Ashley

On Mar 26, 2008, at 1:13 PM, Dustin Suchter wrote:

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 application 
while connected via HTTPS does something like:


$c-res-redirect(http://foo.com/;);

The above seems like a fine solution except it totally disregards the 
beauty of uri_for, which I would love to be using for stuff like this. 
Without uri_for, problems arise when you do things like test via the 
built in Perl webserver (the one running on port 3000 by default) 
while on the same webserver as my production application.


So the real question is, how do I properly refer to my webserver 
and/or application root and include port or SSL flags? I guess I'm 
looking for something like $0 within uri_for.


-d

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-26 Thread Byron Young
 -Original Message-
 From: Dustin Suchter [mailto:[EMAIL PROTECTED]
 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 application
 while
 connected via HTTPS does something like:

 $c-res-redirect(http://foo.com/;);

 The above seems like a fine solution except it totally disregards
 the
 beauty of uri_for, which I would love to be using for stuff like
 this.
 Without uri_for, problems arise when you do things like test via
 the
 built in Perl webserver (the one running on port 3000 by default)
 while
 on the same webserver as my production application.

 So the real question is, how do I properly refer to my webserver
 and/or
 application root and include port or SSL flags? I guess I'm looking
 for
 something like $0 within uri_for.

 -d

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.

Cheers,
Byron

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-26 Thread Ashley

On Mar 26, 2008, at 1:31 PM, Dustin Suchter wrote:
Can you directly control the port you redirect to? Part of my  
problem is having consistency between the production and test  
environments, which operate on 80/443 and 3000/3000 respectively.


Don't see why not. Just add in $c-config magick or whatnot as  
necessary.


perldoc URI

use URI;
my $u = URI-new(http://example.com;);
print $u, $/;

$u-port(3000);
$u-scheme(https);
print $u, $/;


-Ashley


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Usage of $c-uri_for and $c-res-redirect

2008-03-26 Thread KH
$c-uri_for pulls it's base path from $c-req-base.  Quoting the
documentation in the code:
If your application was queried with the URI
Chttp://localhost:3000/some/path then Cbase is Chttp://localhost:3000/
.

So, setting $c-req-base to your new base would do the trick for you I
think.
You would just do $c-req-base('http://www.mysite.tld:443')

I'm sure they're are other ways to do this too.


On Wed, Mar 26, 2008 at 4:31 PM, Dustin Suchter [EMAIL PROTECTED] wrote:

 Can you directly control the port you redirect to? Part of my
 problem is having consistency between the production and test
 environments, which operate on 80/443 and 3000/3000 respectively.

 -d

 Ashley wrote:
  There are two approaches which have helped me. Remember the URI object
  underneath can be your friend.
 
  1) Keep things relative.
 $c-uri_for(/blah)-path
 $c-uri_for(/blah)-path_query
 
  2) Change the scheme yourself.
 my $uri = $c-uri_for(/blah);
 $uri-scheme( $my_test ? http : https );
 
  -Ashley
 
  On Mar 26, 2008, at 1:13 PM, Dustin Suchter wrote:
 
  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 application
  while connected via HTTPS does something like:
 
  $c-res-redirect(http://foo.com/;);
 
  The above seems like a fine solution except it totally disregards the
  beauty of uri_for, which I would love to be using for stuff like this.
  Without uri_for, problems arise when you do things like test via the
  built in Perl webserver (the one running on port 3000 by default)
  while on the same webserver as my production application.
 
  So the real question is, how do I properly refer to my webserver
  and/or application root and include port or SSL flags? I guess I'm
  looking for something like $0 within uri_for.
 
  -d
 
  ___
  List: Catalyst@lists.scsys.co.uk
  Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
  Searchable archive:
  http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
  Dev site: http://dev.catalyst.perl.org/
 
 
  ___
  List: Catalyst@lists.scsys.co.uk
  Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
  Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
  Dev site: http://dev.catalyst.perl.org/
 

 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/




-- 
do() || do_not(); // try()

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane
mittam

http://www.kylehultman.com
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/