summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Quantum
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-05-19 17:33:46 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:56 +0200
commit216af94b979206ee77d3f3b783648a959b120547 (patch)
tree8d08425a6b009558c4c1803f8dfba0de0d667fba /Bugzilla/Quantum
parent20c6de522aa4d27ba3c3f76d68c0b89424789270 (diff)
downloadbugzilla-216af94b979206ee77d3f3b783648a959b120547.tar.gz
bugzilla-216af94b979206ee77d3f3b783648a959b120547.tar.xz
more things
Diffstat (limited to 'Bugzilla/Quantum')
-rw-r--r--Bugzilla/Quantum/CGI.pm62
-rw-r--r--Bugzilla/Quantum/Plugin/Glue.pm3
2 files changed, 55 insertions, 10 deletions
diff --git a/Bugzilla/Quantum/CGI.pm b/Bugzilla/Quantum/CGI.pm
index dd893a0f0..4cbbe0418 100644
--- a/Bugzilla/Quantum/CGI.pm
+++ b/Bugzilla/Quantum/CGI.pm
@@ -7,11 +7,12 @@
package Bugzilla::Quantum::CGI;
use 5.10.1;
+use Carp qw(confess);
use Moo;
has 'controller' => (
is => 'ro',
- handles => [qw(param cookie)],
+ handles => [qw[req res]],
);
has 'csp_object' => (
@@ -24,33 +25,76 @@ with 'Bugzilla::CGI::Role';
sub script_name {
my ($self) = @_;
- return $self->controller->req->env->{SCRIPT_NAME};
+ return $self->req->env->{SCRIPT_NAME};
}
sub referer {
my ($self) = @_;
- my $c = $self->controller;
- return $c->req->headers->referrer;
+ return $self->req->headers->referrer;
}
sub http {
my ($self, $header) = @_;
- return $self->controller->req->headers->header($header);
+ return $self->req->headers->header($header);
}
sub header {
my ($self, @args) = @_;
- my $c = $self->controller;
return '' if @args == 0;
if (@args == 1) {
- $c->res->headers->content_type($args[0]);
+ $self->res->headers->content_type($args[0]);
}
return '';
}
+sub cookie { ## no critic (unpack)
+ my $self = shift;
+ my $c = $self->controller;
+ if (@_ == 1 && !ref $_[0]) {
+ my ($name) = @_;
+ return $c->cookie($name);
+ }
+ else {
+ die "cookie(@_) is not understood";
+ }
+}
+
+sub user_agent {
+ my $self = shift;
+
+ return $self->req->headers->user_agent;
+}
+
+sub url { ## no critic (unpack)
+ my $self = shift;
+ my $c = $self->controller;
+ if ($_[0] eq '-relative' && $_[1] == 1) {
+ return $c->url_for;
+ }
+ else {
+ confess "url(@_) is not understood";
+ }
+}
+
+sub param { ## no critic (unpack)
+ my $self = shift;
+ if (@_ == 1) {
+ my ($name) = @_;
+ return $self->req->param($name);
+ }
+ else {
+ die "param(@_) is not understood";
+ }
+}
+
+sub delete { ## no critic (builtin)
+ my ($self, $name) = @_;
+ $self->req->params->remove($name);
+}
+
sub redirect {
my ($self, $location) = @_;
@@ -60,13 +104,13 @@ sub redirect {
sub Vars {
my ($self) = @_;
- return $self->controller->req->query_params->to_hash;
+ return $self->req->query_params->to_hash;
}
sub query_string {
my ($self) = @_;
- return $self->controller->req->query_params->to_string;
+ return $self->req->query_params->to_string;
}
sub send_cookie {
diff --git a/Bugzilla/Quantum/Plugin/Glue.pm b/Bugzilla/Quantum/Plugin/Glue.pm
index 6c20d87f7..a28c2598d 100644
--- a/Bugzilla/Quantum/Plugin/Glue.pm
+++ b/Bugzilla/Quantum/Plugin/Glue.pm
@@ -48,7 +48,8 @@ sub register {
try {
local %{ Bugzilla->request_cache } = ();
local $CGI::Compile::USE_REAL_EXIT = 0;
- Bugzilla->usage_mode(USAGE_MODE_QUANTUM);
+ # HACK, should just make i_am_cgi smarter.
+ local $ENV{'SERVER_SOFTWARE'} = 1;
Bugzilla->cgi( Bugzilla::Quantum::CGI->new(controller => $c) );
Bugzilla->template( Bugzilla::Quantum::Template->new( controller => $c, template => $template ) );
$next->();