[Bps-public-commit] r20154 - in RT-Extension-rt_cpan_org/html: .
ruz at bestpractical.com
ruz at bestpractical.com
Wed Nov 25 22:23:43 EST 2009
Author: ruz
Date: Wed Nov 25 22:23:43 2009
New Revision: 20154
Added:
RT-Extension-rt_cpan_org/html/Callbacks/rt_cpan_org/autohandler/
RT-Extension-rt_cpan_org/html/Callbacks/rt_cpan_org/autohandler/Init
Modified:
RT-Extension-rt_cpan_org/html/autohandler
Log:
* move some code from autohandler into a callback
Added: RT-Extension-rt_cpan_org/html/Callbacks/rt_cpan_org/autohandler/Init
==============================================================================
--- (empty file)
+++ RT-Extension-rt_cpan_org/html/Callbacks/rt_cpan_org/autohandler/Init Wed Nov 25 22:23:43 2009
@@ -0,0 +1,23 @@
+<%INIT>
+# for testing purposes don't mess
+return if RT->Config->Get('WebDomain') eq 'localhost';
+
+# TODO: change this if there better way to check http vs. https
+if ( ($ENV{'SERVER_PORT'}||0) == 443 || ($ENV{HTTPS}||'') eq 'on' ) {
+ return if RT->Config->Get('WebBaseURL') =~ /^https:/;
+
+ foreach my $opt (qw(WebBaseURL WebURL)) {
+ my $value = RT->Config->Get( $opt );
+ RT->Config->Set( $opt => $value )
+ if $value =~ s{^http:}{https:};
+ }
+} else {
+ return if RT->Config->Get('WebBaseURL') =~ /^http:/;
+
+ foreach my $opt (qw(WebBaseURL WebURL)) {
+ my $value = RT->Config->Get( $opt );
+ RT->Config->Set( $opt => $value )
+ if $value =~ s{^https:}{http:};
+ }
+}
+</%INIT>
Modified: RT-Extension-rt_cpan_org/html/autohandler
==============================================================================
--- RT-Extension-rt_cpan_org/html/autohandler (original)
+++ RT-Extension-rt_cpan_org/html/autohandler Wed Nov 25 22:23:43 2009
@@ -47,14 +47,6 @@
%# END BPS TAGGED BLOCK }}}
<%INIT>
-# TODO: change is if there better way to check http vs. https
-if ( ($ENV{'SERVER_PORT'}||0) == 443 || ($ENV{HTTPS}||'') eq 'on' ) {
- s/^http:/https:/ for $RT::WebURL, $RT::WebBaseURL;
-}
-else {
- s/^https:/http:/ for $RT::WebURL, $RT::WebBaseURL;
-}
-
# Roll back any dangling transactions from a previous failed connection
$RT::Handle->ForceRollback() if $RT::Handle->TransactionDepth;
More information about the Bps-public-commit
mailing list