From 121791e809094cd5eb89fa435e6a374473038630 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 22 May 2012 14:23:37 +0800 Subject: Bug 756005: fix arecibo breaking xmlrpc errors --- Bugzilla/Arecibo.pm | 18 +++++++++++++----- Bugzilla/WebService/Server.pm | 1 - 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Bugzilla/Arecibo.pm b/Bugzilla/Arecibo.pm index de7158349..3e1df3156 100644 --- a/Bugzilla/Arecibo.pm +++ b/Bugzilla/Arecibo.pm @@ -25,6 +25,7 @@ use LWP::UserAgent; use POSIX qw(setsid nice); use Sys::Hostname; +use Bugzilla::Constants; use Bugzilla::Util; use constant CONFIG => { @@ -264,21 +265,28 @@ sub _arecibo_die_handler { $nested_error = $@ if $@; } - # right now it's hard to determine if we've already returned a content-type - # header, it's better to return two than none - print "Content-type: text/html\n\n"; - if ($is_compilation_failure || $in_cgi_carp_die || ($nested_error && $nested_error !~ /\bModPerl::Util::exit\b/) ) { - $nested_error = html_quote($nested_error); my $uid = arecibo_generate_id(); my $notified = arecibo_handle_error('error', $message, $uid); + + # if we aren't dying from a web page, let perl deal with it. this + # does the right thing with respect to returning web service errors + if (Bugzilla->error_mode != ERROR_MODE_WEBPAGE) { + CORE::die($message); + } + + # right now it's hard to determine if we've already returned a + # content-type header, it's better to return two than none + print "Content-type: text/html\n\n"; + my $maintainer = html_quote(Bugzilla->params->{'maintainer'}); $message =~ s/ at \S+ line \d+\.\s*$//; $message = html_quote($message); $uid = html_quote($uid); + $nested_error = html_quote($nested_error); print qq(

Bugzilla has suffered an internal error

$message
diff --git a/Bugzilla/WebService/Server.pm b/Bugzilla/WebService/Server.pm index fdfff0057..4e0315219 100644 --- a/Bugzilla/WebService/Server.pm +++ b/Bugzilla/WebService/Server.pm @@ -26,7 +26,6 @@ use Scalar::Util qw(blessed); sub handle_login { my ($self, $class, $method, $full_method) = @_; eval "require $class"; - warn($@) if $@; ThrowCodeError('unknown_method', {method => $full_method}) if $@; return if ($class->login_exempt($method) and !defined Bugzilla->input_params->{Bugzilla_login}); -- cgit v1.2.3-24-g4f1b