Bug 1136125 - Reduce memory usage of Bugzilla::CGI->send_cookie()

r=dkl, a=glob
parent ee27d535
...@@ -426,33 +426,17 @@ sub should_set { ...@@ -426,33 +426,17 @@ sub should_set {
# pass them around to all of the callers. Instead, store them locally here, # pass them around to all of the callers. Instead, store them locally here,
# and then output as required from |header|. # and then output as required from |header|.
sub send_cookie { sub send_cookie {
my $self = shift; my ($self, %paramhash) = @_;
# Move the param list into a hash for easier handling.
my %paramhash;
my @paramlist;
my ($key, $value);
while ($key = shift) {
$value = shift;
$paramhash{$key} = $value;
}
# Complain if -value is not given or empty (bug 268146). # Complain if -value is not given or empty (bug 268146).
if (!exists($paramhash{'-value'}) || !$paramhash{'-value'}) { ThrowCodeError('cookies_need_value') unless $paramhash{'-value'};
ThrowCodeError('cookies_need_value');
}
# Add the default path and the domain in. # Add the default path and the domain in.
$paramhash{'-path'} = Bugzilla->params->{'cookiepath'}; $paramhash{'-path'} = Bugzilla->params->{'cookiepath'};
$paramhash{'-domain'} = Bugzilla->params->{'cookiedomain'} $paramhash{'-domain'} = Bugzilla->params->{'cookiedomain'}
if Bugzilla->params->{'cookiedomain'}; if Bugzilla->params->{'cookiedomain'};
# Move the param list back into an array for the call to cookie(). push(@{$self->{'Bugzilla_cookie_list'}}, $self->cookie(%paramhash));
foreach (keys(%paramhash)) {
unshift(@paramlist, $_ => $paramhash{$_});
}
push(@{$self->{'Bugzilla_cookie_list'}}, $self->cookie(@paramlist));
} }
# Cookies are removed by setting an expiry date in the past. # Cookies are removed by setting an expiry date in the past.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment