Skip to content

Commit

Permalink
Bug 1136125 - Reduce memory usage of Bugzilla::CGI->send_cookie()
Browse files Browse the repository at this point in the history
r=dkl, a=glob
  • Loading branch information
dylanwh committed Mar 9, 2015
1 parent ee27d53 commit 74fb163
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions Bugzilla/CGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -426,33 +426,17 @@ sub should_set {
# pass them around to all of the callers. Instead, store them locally here,
# and then output as required from |header|.
sub send_cookie {
my $self = shift;

# 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;
}
my ($self, %paramhash) = @_;

# Complain if -value is not given or empty (bug 268146).
if (!exists($paramhash{'-value'}) || !$paramhash{'-value'}) {
ThrowCodeError('cookies_need_value');
}
ThrowCodeError('cookies_need_value') unless $paramhash{'-value'};

# Add the default path and the domain in.
$paramhash{'-path'} = Bugzilla->params->{'cookiepath'};
$paramhash{'-domain'} = Bugzilla->params->{'cookiedomain'}
if Bugzilla->params->{'cookiedomain'};

# Move the param list back into an array for the call to cookie().
foreach (keys(%paramhash)) {
unshift(@paramlist, $_ => $paramhash{$_});
}

push(@{$self->{'Bugzilla_cookie_list'}}, $self->cookie(@paramlist));
push(@{$self->{'Bugzilla_cookie_list'}}, $self->cookie(%paramhash));
}

# Cookies are removed by setting an expiry date in the past.
Expand Down

0 comments on commit 74fb163

Please sign in to comment.