X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=htetc%2Fhandler.pl;h=b00ab6d512dcceae054bdfa74798f6f7b02cfc0a;hp=eb9e67ee5f47d39ec8f164ba51a390a2544e6af4;hb=dc058e6549b8353ae16e8a1b3f6d88b667d5c8d9;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984 diff --git a/htetc/handler.pl b/htetc/handler.pl index eb9e67ee5..b00ab6d51 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -31,11 +31,30 @@ my $ah = new HTML::Mason::ApacheHandler ( # #chown (Apache->server->uid, Apache->server->gid, $interp->files_written); +my $protect_fds; + sub handler { #($r) = @_; my $r = shift; + #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; + } + # If you plan to intermix images in the same directory as # components, activate the following to prevent Mason from # evaluating image files as components. @@ -44,8 +63,8 @@ sub handler ###Module::Refresh->refresh;### - #$r->content_type('text/html; charset=utf-8'); - $r->content_type('text/html; charset=iso-8859-1'); + $r->content_type('text/html; charset=utf-8'); + #$r->content_type('text/html; charset=iso-8859-1'); #eorar my $headers = $r->headers_out;