removed <!-- $Id$ --> from all files to fix any redirects, whew
[freeside.git] / htetc / handler.pl
index f80c79e..5544ebb 100644 (file)
@@ -68,7 +68,7 @@ sub handler
       use FS::Record qw(qsearch qsearchs fields dbdef);
       use FS::Conf;
       use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot
-                     small_custview);
+                     small_custview myexit);
 
       use FS::agent;
       use FS::agent_type;
@@ -101,6 +101,24 @@ sub handler
       use FS::svc_www;
       use FS::type_pkgs;
 
+      *CGI::redirect = sub {
+        my( $self, $location ) = @_;
+
+        #http://www.masonhq.com/docs/faq/#how_do_i_do_an_external_redirect
+        $m->clear_buffer;
+        # The next two lines are necessary to stop Apache from re-reading
+        # POSTed data.
+        $r->method('GET');
+        $r->headers_in->unset('Content-length');
+        $r->content_type('text/html');
+        $r->err_header_out('Location' => $location);
+         $r->header_out('Content-Type' => 'text/html');
+         $m->abort(302);
+
+        '';
+    
+      };
+
       $cgi = new CGI;
       &cgisuidsetup($cgi);
       #&cgisuidsetup($r);
@@ -109,11 +127,13 @@ sub handler
     $r->content_type('text/html');
     #eorar
 
-    # @FS::CGI::headers or some other way to set no-cache headers!!!
-    
-    my $status = $ah->handle_request($r);
+    my $headers = $r->headers_out;
+    $headers->{'Pragma'} = $headers->{'Cache-control'} = 'no-cache';
+    #$r->no_cache(1);
+    $headers->{'Expires'} = '0';
     
-    return $status;
+    $ah->handle_request($r);
+
 }
 
 1;