X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FMason%2FRequest.pm;h=0d21df4ca2b648251a67e5183d44e081c58b9286;hp=0a1df874a65cde0a488526d0c1e5df27682a8e49;hb=22a1feb55c4bb705064a04646ff5c321b8112ce1;hpb=63a268637b2d51a8766412617724b9436439deb6 diff --git a/FS/FS/Mason/Request.pm b/FS/FS/Mason/Request.pm index 0a1df874a..0d21df4ca 100644 --- a/FS/FS/Mason/Request.pm +++ b/FS/FS/Mason/Request.pm @@ -24,22 +24,54 @@ sub new { my %opt = @_; my $mode = $superclass =~ /Apache/i ? 'apache' : 'standalone'; - freeside_setup($opt{'comp'}, $mode); + $class->freeside_setup($opt{'comp'}, $mode); $class->SUPER::new(@_); } +#override alter_superclass ala RT::Interface::Web::Request ?? +# for Mason 1.39 vs. Perl 5.10.0 + +my $protect_fds; + sub freeside_setup { + my( $class, $filename, $mode ) = @_; + + #from rt/bin/webmux.pl(.in) + if ( !$protect_fds && $ENV{'MOD_PERL'} && exists $ENV{'MOD_PERL_API_VERSION'} + && $ENV{'MOD_PERL_API_VERSION'} >= 2 + ) { + # under mod_perl2, STDIN and STDOUT get closed and re-opened, + # however they are not on FD 0 and 1. In this case, the next + # socket that gets opened will occupy one of these FDs, and make + # all system() and open "|-" calls dangerous; for example, the + # DBI handle can get this FD, which later system() calls will + # close by putting garbage into the socket. + $protect_fds = []; + push @{$protect_fds}, IO::Handle->new_from_fd(0, "r") + if fileno(STDIN) != 0; + push @{$protect_fds}, IO::Handle->new_from_fd(1, "w") + if fileno(STDOUT) != 1; + } - my( $filename, $mode ) = @_; + if ( $filename =~ qr(/REST/\d+\.\d+/NoAuth/) ) { - #warn "initializing for $filename\n"; + package HTML::Mason::Commands; #? + use FS::UID qw( adminsuidsetup ); - if ( $filename !~ /\/rt\/.*NoAuth/ ) { #not RT images/JS + #need to log somebody in for the mail gw + + ##old installs w/fs_selfs or selfserv?? + #&adminsuidsetup('fs_selfservice'); + + &adminsuidsetup('fs_queue'); + + } else { package HTML::Mason::Commands; - use vars qw( $cgi $p $fsurl ); + use vars qw( $cgi $p $fsurl ); # $lh ); #not using /mt + use Encode; use FS::UID qw( cgisuidsetup ); use FS::CGI qw( popurl rooturl ); @@ -59,20 +91,25 @@ sub freeside_setup { die "unknown mode $mode"; } - } elsif ( $filename =~ /\/rt\/REST\/.*NoAuth/ ) { - - package HTML::Mason::Commands; #? - use FS::UID qw( adminsuidsetup ); - - #need to log somebody in for the mail gw - - ##old installs w/fs_selfs or selfserv?? - #&adminsuidsetup('fs_selfservice'); + # + foreach my $param ( $cgi->param ) { + my @values = $cgi->param($param); + next if $cgi->uploadInfo($values[0]); + #warn $param; + @values = map decode(utf8=>$_), @values; + $cgi->param($param, @values); + } + + } - &adminsuidsetup('fs_queue'); +} - } +sub callback { + RT::Interface::Web::Request::callback(@_); +} +sub request_path { + RT::Interface::Web::Request::request_path(@_); } 1;