diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-03-23 16:11:31 -0700 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-03-23 16:11:31 -0700 |
commit | 81714e248b1a1a3da1dd2d771118371bc8c7ffb0 (patch) | |
tree | 47e9b05188d377fc8ac7ab5cdaa041e36200bf9b /Bugzilla | |
parent | ccb36aaa7adc9d07d74dd5c2e64763cc8749cf4c (diff) | |
download | bugs-81714e248b1a1a3da1dd2d771118371bc8c7ffb0.tar bugs-81714e248b1a1a3da1dd2d771118371bc8c7ffb0.tar.gz bugs-81714e248b1a1a3da1dd2d771118371bc8c7ffb0.tar.bz2 bugs-81714e248b1a1a3da1dd2d771118371bc8c7ffb0.tar.xz bugs-81714e248b1a1a3da1dd2d771118371bc8c7ffb0.zip |
Bug 553774: Make User.login correctly return cookies under JSON-RPC
r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/WebService/Server/JSONRPC.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm index d07901a7f..3ec64c6bc 100644 --- a/Bugzilla/WebService/Server/JSONRPC.pm +++ b/Bugzilla/WebService/Server/JSONRPC.pm @@ -52,6 +52,25 @@ sub create_json_coder { # Override the JSON::RPC method to return our CGI object instead of theirs. 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 { my ($self, $type, $value) = @_; |