X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMason%2FRequest.pm;h=99a8daa60dbc986fda3edd23db279d9b97a636a8;hb=368ed08e24400e9d1faf401a1e4e23ea54d2c969;hp=36c46dc41bda9eb87667081e7ce5d6175c7b10da;hpb=07d63243b070962b8fcf8e6b59128ccf1305f8f8;p=freeside.git diff --git a/FS/FS/Mason/Request.pm b/FS/FS/Mason/Request.pm index 36c46dc41..99a8daa60 100644 --- a/FS/FS/Mason/Request.pm +++ b/FS/FS/Mason/Request.pm @@ -4,6 +4,7 @@ use strict; use warnings; use vars qw( $FSURL $QUERY_STRING ); use base 'HTML::Mason::Request'; +use IO::Handle; use FS::Trace; $FSURL = 'http://Set/FS_Mason_Request_FSURL/in_standalone_mode/'; @@ -45,12 +46,11 @@ my $protect_fds; sub freeside_setup { my( $class, $filename, $mode ) = @_; - FS::Trace->log(' protecting fds'); - #from rt/bin/webmux.pl(.in) if ( !$protect_fds && $ENV{'MOD_PERL'} && exists $ENV{'MOD_PERL_API_VERSION'} && $ENV{'MOD_PERL_API_VERSION'} >= 2 ) { + FS::Trace->log(' protecting fds'); # 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 @@ -64,12 +64,18 @@ sub freeside_setup { if fileno(STDOUT) != 1; } + if ( $HTML::Mason::Commands::r ) { + FS::Trace->log(' adding headers'); + #frame-ancestors not supported by all the major browsers yet + $HTML::Mason::Commands::r->header_out( 'X-Frame-Options', 'SAMEORIGIN' ); + } + if ( $filename =~ qr(/REST/\d+\.\d+/NoAuth/) ) { FS::Trace->log(' handling RT REST/NoAuth file'); package HTML::Mason::Commands; #? - use FS::UID qw( adminsuidsetup ); + use FS::UID qw( adminsuidsetup setcgi ); #need to log somebody in for the mail gw @@ -86,14 +92,15 @@ sub freeside_setup { package HTML::Mason::Commands; use vars qw( $cgi $p $fsurl ); # $lh ); #not using /mt use Encode; - use FS::UID qw( cgisuidsetup ); + #use FS::UID qw( cgisuidsetup ); use FS::CGI qw( popurl rooturl ); if ( $mode eq 'apache' ) { $cgi = new CGI; - FS::Trace->log(' cgisuidsetup'); - &cgisuidsetup($cgi); - #&cgisuidsetup($r); + setcgi($cgi); + + #cgisuidsetup is gone, equivalent is now done in AuthCookieHandler + $fsurl = rooturl(); $p = popurl(2); } elsif ( $mode eq 'standalone' ) { @@ -106,19 +113,23 @@ sub freeside_setup { die "unknown mode $mode"; } - FS::Trace->log(' UTF-8-decoding form data'); - # - 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); + FS::Trace->log(' UTF-8-decoding form data'); + # + foreach my $param ( $cgi->param ) { + + #we can't switch to multi_param until we're done supporting deb 7 + local($CGI::LIST_CONTEXT_WARN) = 0; + + my @values = $cgi->param($param); + next if $cgi->uploadInfo($values[0]); + #warn $param; + @values = map decode(utf8=>$_), @values; + $cgi->param($param, @values); + } + } - - } - FS::Trace->log(' done'); + FS::Trace->log(' done'); }