X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htetc%2Fhandler.pl;h=c5f685f85aa57f91e145ee37a9b6c8ceb36f86bb;hb=c4ff840a85e33c86ecad9223d074d57cba50e0f9;hp=b28cfe9e27d3c76d0f5ce93167e53f62a8321d34;hpb=abf5c5442afce5198f6289840791c96f58254e85;p=freeside.git diff --git a/htetc/handler.pl b/htetc/handler.pl index b28cfe9e2..c5f685f85 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -62,7 +62,7 @@ sub handler { package HTML::Mason::Commands; use strict; use vars qw( $cgi $p ); - use CGI; + use CGI 2.47; #use CGI::Carp qw(fatalsToBrowser); use Date::Format; use Date::Parse; @@ -114,39 +114,38 @@ sub handler use FS::router; use FS::addr_block; use FS::svc_broadband; + use FS::svc_external; use FS::type_pkgs; use FS::part_export; use FS::part_export_option; use FS::export_svc; use FS::msgcat; - *notCGI::redirect = sub { + *CGI::redirect = sub { my( $self, $location ) = @_; use vars qw($m); if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect - # my $page = - - - # return $page; + my $page = + qq!Redirect to $location!. + '

'.
+              ( UNIVERSAL::can(dbh, 'sprintProfile')
+                  ? encode_entities(dbh->sprintProfile())
+                  : 'DBIx::Profile missing sprintProfile method;'.
+                    'unpatched or too old?'                        ).
+            #"\n\n". &sprintAutoProfile().  '
'. + "\n\n". ''. + ''; + dbh->{'private_profile'} = {}; + return $page; } else { #normal redirect - #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('Location' => $location); - $r->header_out('Content-Type' => 'text/html'); - $m->abort(302); - + $m->redirect($location); ''; - } + + } }; @@ -160,6 +159,36 @@ sub handler $m->scomp(@_); } + sub redirect { + my( $location ) = @_; + use vars qw($m); + $m->clear_buffer; + #false laziness w/above + if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect + + $m->print( + qq!Redirect to $location!. + '

'.
+              ( UNIVERSAL::can(dbh, 'sprintProfile')
+                  ? encode_entities(dbh->sprintProfile())
+                  : 'DBIx::Profile missing sprintProfile method;'.
+                    'unpatched or too old?'                        ).
+            #"\n\n". &sprintAutoProfile().  '
'. + "\n\n". ''. + '' + ); + dbh->{'private_profile'} = {}; + + $m->abort(200); + + } else { #normal redirect + + $m->redirect($location); + + } + + } + } # end package HTML::Mason::Commands; $r->content_type('text/html');