[Bps-public-commit] r16041 - RT-Extension-rt_cpan_org/html

ruz at bestpractical.com ruz at bestpractical.com
Tue Sep 23 19:45:54 EDT 2008


Author: ruz
Date: Tue Sep 23 19:45:52 2008
New Revision: 16041

Modified:
   RT-Extension-rt_cpan_org/html/autohandler

Log:
* add checks based on HTTPS environment variable to avoid redirect loops
  and to keep links around correct

Modified: RT-Extension-rt_cpan_org/html/autohandler
==============================================================================
--- RT-Extension-rt_cpan_org/html/autohandler	(original)
+++ RT-Extension-rt_cpan_org/html/autohandler	Tue Sep 23 19:45:52 2008
@@ -48,12 +48,12 @@
 <%INIT>
 
 # TODO: change is if there better way to check http vs. https
-if ( ($ENV{'SERVER_PORT'}||0) == 80 ) {
-    s/^https:/http:/ for $RT::WebURL, $RT::WebBaseURL;
-}
-elsif ( ($ENV{'SERVER_PORT'}||0) == 443 ) {
+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;
@@ -286,8 +286,8 @@
 # If we have no credentials
 else {
     # check if we are in HTTPS mode
-    if (    not defined $ENV{'HTTP_X_FORWARDED_HOST'}
-        and not defined $ARGS{nossl})
+    if ( not defined $ARGS{nossl} 
+        and (not defined $ENV{'HTTP_X_FORWARDED_HOST'} or ($ENV{'HTTPS'}||'') ne 'on' ))
     {
         $m->redirect('https://'.$ENV{SERVER_NAME}.$ENV{REQUEST_URI});
     }



More information about the Bps-public-commit mailing list