summaryrefslogtreecommitdiffstats
path: root/Bugzilla/PSGI.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-04 01:38:10 +0100
committerDylan William Hardison <dylan@hardison.net>2018-03-10 21:54:38 +0100
commitf57a87a51e4d3e39a6fc552b963621625b2db899 (patch)
tree227a6d6aa6b489ba4eeb0c9eebe1a2e538f08b2a /Bugzilla/PSGI.pm
parent44c80b15fab8390b13ec32e45bb03145a8769654 (diff)
downloadbugzilla-f57a87a51e4d3e39a6fc552b963621625b2db899.tar.gz
bugzilla-f57a87a51e4d3e39a6fc552b963621625b2db899.tar.xz
make sure init_page() is called inside a CGI environment
Diffstat (limited to 'Bugzilla/PSGI.pm')
-rw-r--r--Bugzilla/PSGI.pm18
1 files changed, 12 insertions, 6 deletions
diff --git a/Bugzilla/PSGI.pm b/Bugzilla/PSGI.pm
index 22e08540d..854ae733a 100644
--- a/Bugzilla/PSGI.pm
+++ b/Bugzilla/PSGI.pm
@@ -12,19 +12,26 @@ use warnings;
use base qw(Exporter);
+use Bugzilla::Logging;
+use CGI::Compile;
+use CGI::Emulate::PSGI;
+
our @EXPORT_OK = qw(compile_cgi);
sub compile_cgi {
my ($script) = @_;
- my $app = Plack::App::WrapCGI->new( script => $script )->to_app;
-
+ my $cgi = CGI::Compile->compile($script);
+ my $app = CGI::Emulate::PSGI->handler(
+ sub {
+ Bugzilla::init_page();
+ $cgi->();
+ }
+ );
return sub {
- my ($env) = @_;
- Bugzilla::init_page();
+ my $env = shift;
if ($env->{'psgix.cleanup'}) {
push @{ $env->{'psgix.cleanup.handler'} }, \&Bugzilla::_cleanup;
}
-
my $res = $app->($env);
Bugzilla::_cleanup() if not $env->{'psgix.cleanup'};
return $res;
@@ -32,5 +39,4 @@ sub compile_cgi {
}
-
1; \ No newline at end of file