summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Quantum/CGI.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-05-19 06:34:01 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:55 +0200
commit10918f3336863623020a6d73e63a0f0a5eebb306 (patch)
treea496e36a1f149e193a4ceed41531034a6b2ae888 /Bugzilla/Quantum/CGI.pm
parent215f1021948b63cad29094e7847b52c256ec9974 (diff)
downloadbugzilla-10918f3336863623020a6d73e63a0f0a5eebb306.tar.gz
bugzilla-10918f3336863623020a6d73e63a0f0a5eebb306.tar.xz
mojo all the things
Diffstat (limited to 'Bugzilla/Quantum/CGI.pm')
-rw-r--r--Bugzilla/Quantum/CGI.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/Bugzilla/Quantum/CGI.pm b/Bugzilla/Quantum/CGI.pm
index 34db9a46f..e5db4123f 100644
--- a/Bugzilla/Quantum/CGI.pm
+++ b/Bugzilla/Quantum/CGI.pm
@@ -63,4 +63,32 @@ sub Vars {
return $self->controller->req->query_params->to_hash;
}
+sub query_string {
+ my ($self) = @_;
+
+ return $self->controller->req->query_params->to_string;
+}
+
+sub send_cookie {
+ my ($self, %params) = @_;
+ my $name = delete $params{'-name'};
+ my $value = delete $params{'-value'} or ThrowCodeError('cookies_need_value');
+ state $uri = URI->new( Bugzilla->localconfig->{urlbase} );
+ my %attrs = (
+ path => $uri->path,
+ secure => lc( $uri->scheme ) eq 'https',
+ samesite => 'Lax',
+ );
+ my $expires = delete $params{'-expires'};
+ $attrs{expires} = $expires if $expires;
+ $attrs{httponly} = 1 if delete $params{'-httponly'};
+
+ if (keys %params) {
+ die "Unknown keys: " . join(", ", keys %params);
+ }
+
+ $self->controller->cookie($name, $value, \%params);
+}
+
1;
+