From ed6d5cdaaeac6422e5933e4e8138b481e35ab4f3 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 3 Apr 2018 23:05:04 -0400 Subject: initial proof of concept of mojolicious inside bmo --- Bugzilla/CGI/Mojo.pm | 29 +++++++++++++++++++++++++++++ Bugzilla/Constants.pm | 2 ++ Bugzilla/Install/Filesystem.pm | 1 + Bugzilla/ModPerl.pm | 7 +++++++ 4 files changed, 39 insertions(+) create mode 100644 Bugzilla/CGI/Mojo.pm (limited to 'Bugzilla') diff --git a/Bugzilla/CGI/Mojo.pm b/Bugzilla/CGI/Mojo.pm new file mode 100644 index 000000000..0ae12f976 --- /dev/null +++ b/Bugzilla/CGI/Mojo.pm @@ -0,0 +1,29 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::CGI::Mojo; +use 5.10.1; +use Moo; + +has 'controller' => ( + is => 'ro', + handles => [qw(param cookie)], +); + +sub script_name { + my ($self) = @_; + + return $self->controller->req->env->{SCRIPT_NAME}; +} + +sub Vars { + my ($self) = @_; + + return $self->controller->req->query_params->to_hash; +} + +1; \ No newline at end of file diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 3aa7b0fa4..8ef776f96 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -130,6 +130,7 @@ use Memoize; USAGE_MODE_JSON USAGE_MODE_TEST USAGE_MODE_REST + USAGE_MODE_MOJO ERROR_MODE_WEBPAGE ERROR_MODE_DIE @@ -487,6 +488,7 @@ use constant USAGE_MODE_EMAIL => 3; use constant USAGE_MODE_JSON => 4; use constant USAGE_MODE_TEST => 5; use constant USAGE_MODE_REST => 6; +use constant USAGE_MODE_MOJO => 7; # Error modes. Default set by Bugzilla->usage_mode (so ERROR_MODE_WEBPAGE # usually). Use with Bugzilla->error_mode. diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 003be22e4..739ea9a0a 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -214,6 +214,7 @@ sub FILESYSTEM { # users to be able to cron them or otherwise run # them as a secure user, like the webserver owner. '*.cgi' => { perms => WS_EXECUTE }, + '*.psgi' => { perms => CGI_READ }, 'whineatnews.pl' => { perms => WS_EXECUTE }, 'collectstats.pl' => { perms => WS_EXECUTE }, 'importxml.pl' => { perms => WS_EXECUTE }, diff --git a/Bugzilla/ModPerl.pm b/Bugzilla/ModPerl.pm index 19cd1128f..6f7ed22e9 100644 --- a/Bugzilla/ModPerl.pm +++ b/Bugzilla/ModPerl.pm @@ -109,6 +109,13 @@ ErrorDocument 500 /errors/500.html require valid-user + + SetHandler perl-script + PerlResponseHandler Plack::Handler::Apache2 + PerlSetEnv MOJO_HOME [% cgi_path %] + PerlSetVar psgi_app [% cgi_path %]/new.psgi + + # directory rules for all the other places we have .htaccess files [% FOREACH htaccess IN htaccess_files %] # from [% htaccess.file %] -- cgit v1.2.3-24-g4f1b