diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-05-22 02:54:58 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-06-28 22:41:57 +0200 |
commit | e216176239965bb5bd98a0008fd8c71b14ee9624 (patch) | |
tree | ba7e201ba6ba4c530e77574e0cb2796b46841e43 /Bugzilla/Quantum/CGI.pm | |
parent | f2f708f6985dd3a7c51869c0dda5791ca239d248 (diff) | |
download | bugzilla-e216176239965bb5bd98a0008fd8c71b14ee9624.tar.gz bugzilla-e216176239965bb5bd98a0008fd8c71b14ee9624.tar.xz |
almost everything works
Diffstat (limited to 'Bugzilla/Quantum/CGI.pm')
-rw-r--r-- | Bugzilla/Quantum/CGI.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Bugzilla/Quantum/CGI.pm b/Bugzilla/Quantum/CGI.pm index c0fb04c22..9874280bc 100644 --- a/Bugzilla/Quantum/CGI.pm +++ b/Bugzilla/Quantum/CGI.pm @@ -21,6 +21,8 @@ use Socket qw(AF_INET inet_aton); use Sys::Hostname; use English qw(-no_match_vars); +our $C; + sub load_all { my ($class, $r) = @_; my $stash = Package::Stash->new(__PACKAGE__); @@ -61,12 +63,13 @@ sub _load_cgi { my ($c) = @_; my $stdin = $c->_STDIN; my $stdout = ''; - local %ENV = $c->_ENV; + local $C = $c; + local %ENV = $c->_ENV($file); local *STDIN; ## no critic (local) local $CGI::Compile::USE_REAL_EXIT = 0; local $PROGRAM_NAME = $file; open STDIN, '<', $stdin->path or die "STDIN @{[$stdin->path]}: $!" if -s $stdin->path; - tie STDOUT, 'Bugzilla::Quantum::Stdout', controller => $c; ## no critic (tie) + tie *STDOUT, 'Bugzilla::Quantum::Stdout', controller => $c; ## no critic (tie) try { Bugzilla->init_page(); $inner->(); @@ -75,6 +78,8 @@ sub _load_cgi { die $_ unless ref $_ eq 'ARRAY' && $_->[0] eq "EXIT\n" || /\bModPerl::Util::exit\b/; } finally { + untie *STDOUT; + $c->finish; Bugzilla->_cleanup; ## no critic (private) CGI::initialize_globals(); }; @@ -83,7 +88,7 @@ sub _load_cgi { } sub _ENV { - my ($c) = @_; + my ($c, $script_name) = @_; my $tx = $c->tx; my $req = $tx->req; my $headers = $req->headers; @@ -119,7 +124,7 @@ sub _ENV { REMOTE_PORT => $tx->remote_port, REMOTE_USER => $remote_user || '', REQUEST_METHOD => $req->method, - SCRIPT_NAME => $req->env->{SCRIPT_NAME}, + SCRIPT_NAME => "/$script_name", SERVER_NAME => hostname, SERVER_PORT => $tx->local_port, SERVER_PROTOCOL => $req->is_secure ? 'HTTPS' : 'HTTP', # TODO: Version is missing |