This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git] / rt / bin / mason_handler.fcgi
1 #!/usr/bin/perl
2 # BEGIN LICENSE BLOCK
3
4 # Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5
6 # (Except where explictly superceded by other copyright notices)
7
8 # This work is made available to you under the terms of Version 2 of
9 # the GNU General Public License. A copy of that license should have
10 # been provided with this software, but in any event can be snarfed
11 # from www.gnu.org.
12
13 # This work is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 # General Public License for more details.
17
18 # Unless otherwise specified, all modifications, corrections or
19 # extensions to this work which alter its source code become the
20 # property of Best Practical Solutions, LLC when submitted for
21 # inclusion in the work.
22
23
24 # END LICENSE BLOCK
25
26 use strict;
27 use File::Basename;
28 require ('/opt/rt3/bin/webmux.pl');
29
30 my $h = &RT::Interface::Web::NewCGIHandler();
31
32 # Enter CGI::Fast mode, which should also work as a vanilla CGI script.
33 require CGI::Fast;
34
35 RT::Init();
36
37 # Response loop
38 while ( my $cgi = CGI::Fast->new ) {
39     # the whole point of fastcgi requires the env to get reset here..
40     # So we must squash it again
41     $ENV{'PATH'}   = '/bin:/usr/bin';
42     $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
43     $ENV{'SHELL'}  = '/bin/sh' if defined $ENV{'SHELL'};
44     $ENV{'ENV'}    = '' if defined $ENV{'ENV'};
45     $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
46
47     unless ($h->interp->comp_exists($cgi->path_info)) {
48         $cgi->path_info($cgi->path_info . "/index.html");
49     }
50     $h->handle_cgi_object($cgi);
51     # _should_ always be tied
52 }
53
54 1;