1 package FS::Mason::Request;
5 use vars qw( $FSURL $QUERY_STRING );
6 use base 'HTML::Mason::Request';
8 $FSURL = 'http://Set/FS_Mason_Request_FSURL/in_standalone_mode/';
14 my $superclass = $HTML::Mason::ApacheHandler::VERSION ?
15 'HTML::Mason::Request::ApacheHandler' :
16 $HTML::Mason::CGIHandler::VERSION ?
17 'HTML::Mason::Request::CGI' :
18 'HTML::Mason::Request';
20 $class->alter_superclass( $superclass );
22 #huh... shouldn't alter_superclass take care of this for us?
23 __PACKAGE__->valid_params( %{ $superclass->valid_params() } );
26 my $mode = $superclass =~ /Apache/i ? 'apache' : 'standalone';
27 $class->freeside_setup($opt{'comp'}, $mode);
29 $class->SUPER::new(@_);
33 #override alter_superclass ala RT::Interface::Web::Request ??
34 # for Mason 1.39 vs. Perl 5.10.0
39 my( $class, $filename, $mode ) = @_;
41 #from rt/bin/webmux.pl(.in)
42 if ( !$protect_fds && $ENV{'MOD_PERL'} && exists $ENV{'MOD_PERL_API_VERSION'}
43 && $ENV{'MOD_PERL_API_VERSION'} >= 2
45 # under mod_perl2, STDIN and STDOUT get closed and re-opened,
46 # however they are not on FD 0 and 1. In this case, the next
47 # socket that gets opened will occupy one of these FDs, and make
48 # all system() and open "|-" calls dangerous; for example, the
49 # DBI handle can get this FD, which later system() calls will
50 # close by putting garbage into the socket.
52 push @{$protect_fds}, IO::Handle->new_from_fd(0, "r")
53 if fileno(STDIN) != 0;
54 push @{$protect_fds}, IO::Handle->new_from_fd(1, "w")
55 if fileno(STDOUT) != 1;
58 if ( $filename =~ qr(/REST/\d+\.\d+/NoAuth/) ) {
60 package HTML::Mason::Commands; #?
61 use FS::UID qw( adminsuidsetup );
63 #need to log somebody in for the mail gw
65 ##old installs w/fs_selfs or selfserv??
66 #&adminsuidsetup('fs_selfservice');
68 &adminsuidsetup('fs_queue');
72 package HTML::Mason::Commands;
73 use vars qw( $cgi $p $fsurl ); # $lh ); #not using /mt
75 use FS::UID qw( cgisuidsetup );
76 use FS::CGI qw( popurl rooturl );
78 if ( $mode eq 'apache' ) {
84 } elsif ( $mode eq 'standalone' ) {
85 $cgi = new CGI $FS::Mason::Request::QUERY_STRING; #better keep setting
88 $fsurl = $FS::Mason::Request::FSURL; #kludgy, but what the hell
89 $p = popurl(2, "$fsurl$filename");
91 die "unknown mode $mode";
95 foreach my $param ( $cgi->param ) {
96 my @values = $cgi->param($param);
97 next if $cgi->uploadInfo($values[0]);
99 @values = map decode(utf8=>$_), @values;
100 $cgi->param($param, @values);
108 RT::Interface::Web::Request::callback(@_);
112 RT::Interface::Web::Request::request_path(@_);