From 6c5fcdfbe3594b7311ab0bea417fc68f2eb9337d Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 14 Oct 2018 22:49:10 +0200 Subject: Revert "Bug 1495741 - memory issues: Avoid copying stuff in the webservice layer so much" Fix an "Unexpected Error" message when viewing a bug. This reverts commit 5688d0e712b85bc892ce405a1b79e3571f6d6d0f. Signed-off-by: Florian Pritz --- Bugzilla/WebService/Server/JSONRPC.pm | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'Bugzilla/WebService/Server/JSONRPC.pm') diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm index ef00737ad..c9c11e0d4 100644 --- a/Bugzilla/WebService/Server/JSONRPC.pm +++ b/Bugzilla/WebService/Server/JSONRPC.pm @@ -32,9 +32,7 @@ use Bugzilla::Util; use HTTP::Message; use MIME::Base64 qw(decode_base64 encode_base64); -use Scalar::Util qw(blessed); use List::MoreUtils qw(none); -use Bugzilla::WebService::JSON; ##################################### # Public JSON::RPC Method Overrides # @@ -51,7 +49,7 @@ sub new { sub create_json_coder { my $self = shift; - my $json = Bugzilla::WebService::JSON->new; + my $json = $self->SUPER::create_json_coder(@_); $json->allow_blessed(1); $json->convert_blessed(1); $json->allow_nonref(1); @@ -89,9 +87,6 @@ sub response { # Implement JSONP. if (my $callback = $self->_bz_callback) { my $content = $response->content; - if (blessed $content) { - $content = $content->encode; - } # Prepend the JSONP response with /**/ in order to protect # against possible encoding attacks (e.g., affecting Flash). @@ -120,12 +115,7 @@ sub response { else { push(@header_args, "-ETag", $etag) if $etag; print $cgi->header(-status => $response->code, @header_args); - my $content = $response->content; - if (blessed $content) { - $content = $content->encode; - utf8::encode($content); - } - print $content; + print $response->content; } } @@ -375,7 +365,7 @@ sub _argument_type_check { # Now, convert dateTime fields on input. $self->_bz_method_name =~ /^(\S+)\.(\S+)$/; my ($class, $method) = ($1, $2); - my $pkg = $self->{dispatch_path}->{$class}; + my $pkg = $self->{dispatch_path}->{$class}; my @date_fields = @{$pkg->DATE_FIELDS->{$method} || []}; foreach my $field (@date_fields) { if (defined $params->{$field}) { -- cgit v1.2.3-24-g4f1b