summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/PSGI.pm18
-rw-r--r--app.psgi2
2 files changed, 13 insertions, 7 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
diff --git a/app.psgi b/app.psgi
index 48b730167..1da6d4351 100644
--- a/app.psgi
+++ b/app.psgi
@@ -30,12 +30,12 @@ BEGIN {
}
# This loads most of our modules.
+use Bugzilla::PSGI qw(compile_cgi);
use Bugzilla::Logging;
use Bugzilla ();
use Bugzilla::Constants ();
use Bugzilla::BugMail ();
use Bugzilla::CGI ();
-use Bugzilla::PSGI qw(compile_cgi);
use Bugzilla::Extension ();
use Bugzilla::Install::Requirements ();
use Bugzilla::Util ();