Commit 81714e24 authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

Bug 553774: Make User.login correctly return cookies under JSON-RPC

r=dkl, a=mkanat
parent ccb36aaa
...@@ -52,6 +52,25 @@ sub create_json_coder { ...@@ -52,6 +52,25 @@ sub create_json_coder {
# Override the JSON::RPC method to return our CGI object instead of theirs. # Override the JSON::RPC method to return our CGI object instead of theirs.
sub cgi { return Bugzilla->cgi; } sub cgi { return Bugzilla->cgi; }
# Override the JSON::RPC method to use $cgi->header properly instead of
# just printing text directly. This fixes various problems, including
# sending Bugzilla's cookies properly.
sub response {
my ($self, $response) = @_;
my $headers = $response->headers;
my @header_args;
foreach my $name ($headers->header_field_names) {
my @values = $headers->header($name);
$name =~ s/-/_/g;
foreach my $value (@values) {
push(@header_args, "-$name", $value);
}
}
my $cgi = $self->cgi;
print $cgi->header(-status => $response->code, @header_args);
print $response->content;
}
sub type { sub type {
my ($self, $type, $value) = @_; my ($self, $type, $value) = @_;
......
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