[rt-devel] rt-3.0.7_01 patch for mod_perl 2 redirect issue

mixo mixo at coza.net.za
Thu Dec 18 04:09:35 EST 2003


This patch is intendent to try an address "The page has moved to ..." 
when doing a
quick search in rt 3.0.7_01 running under mod_perl2 (1.99).  The patch 
uses html
"refresh" instead of mod_perl "redirect" when mod_perl2 has been detected.
Try it with caution as it is still being tested. So far it is known to 
work on Mozilla 1.4,
Konquerer 3.1, I.E. 6 and   Opera 7.11 with  automatic redirection is 
turned on in
Preferences > Privacy.

Note, since meta refresh is used, after clicking on "Search" button, the 
current contents
are displayed before the refresh is complete.


To apply that patch (get a backup of the original file):
  patch -b /the/path/to/rt3/share/html/index.html 
/path/to/patch/index.html.modperl2-patch1
-------------- next part --------------
--- index.html	2003-11-18 05:54:09.000000000 +0200
+++ /opt/rt3-my-3/share/html/index.html	2003-12-18 10:16:13.000000000 +0200
@@ -43,11 +43,37 @@
 </TR>
 </TABLE>
 <%init>
+sub http_redirect {
+
+  my $url = shift;
+  my $delay = shift;
+
+  print <<EOT;
+<html>
+<head>
+<title>Redirect to $url</title>
+<meta http-equiv="refresh" content="$delay; url=$url">
+</head>
+<body bgcolor="#ffffff">
+<!--p align=center><a href="$url">$url</a></p--> 
+</body>
+</html>
+EOT
+}
+
+my $redirected = undef;
+
 if ( $ARGS{'q'} ) {
     my $query = $ARGS{'q'};
 
     if ( $query =~ m/^\s*(\d+)\s*$/ ) {
+      if ($mod_perl::VERSION >= 1.9908)  {
+         http_redirect("$RT::WebPath/Ticket/Display.html?id=$1",0);
+         $redirected = 1;
+      }  
+      else {
         $m->redirect("$RT::WebPath/Ticket/Display.html?id=$1");
+      }
     }
 
     $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
@@ -55,7 +81,12 @@
     if ( $query =~ m/\@/ ) {
         $session{'tickets'}->LimitRequestor( VALUE    => $query,
                                              OPERATOR => '=', );
-        $m->redirect("$RT::WebPath/Search/Listing.html");
+        if ($mod_perl::VERSION >= 1.9908) {
+          http_redirect("$RT::WebPath/Search/Listing.html?$query",0);
+        }  
+        else {
+          $m->redirect("$RT::WebPath/Search/Listing.html");
+        }
     }
 
     #
@@ -69,16 +100,26 @@
     if ( $queue->Load($query) && $queue->Id ) {
         $session{'tickets'}->LimitQueue( VALUE    => $queue->Id,
                                          OPERATOR => '=', );
+      if ($mod_perl::VERSION >= 1.9908)  {
+        http_redirect("$RT::WebPath/Search/Listing.html",0);
+      }  
+      else {
         $m->redirect("$RT::WebPath/Search/Listing.html");
+      }
     }
     $session{'tickets'}->LimitSubject( VALUE    =>  $query,
                                        OPERATOR => 'LIKE' );
-
-    $m->redirect("$RT::WebPath/Search/Listing.html");
+    if ($mod_perl::VERSION >= 1.9908)  {
+      if (!$redirected)  {
+        http_redirect("$RT::WebPath/Search/Listing.html",0);
+      }
+    }
+    else {
+      $m->redirect("$RT::WebPath/Search/Listing.html");
+    }
 }
 
 if ($ARGS{'HomeRefreshInterval'}) {
 	$session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'};
 }
-
 </%init>


More information about the Rt-devel mailing list