From 7fb268f1a7b2462026fa48e3338e364533f4dbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 24 Jun 2019 14:37:40 +0300 Subject: [PATCH] MXS-2575: Fix REST-API error propagation The errors are now correctly sent even with requests that upload data. --- server/core/admin.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/core/admin.cc b/server/core/admin.cc index 58396473a..c99771115 100644 --- a/server/core/admin.cc +++ b/server/core/admin.cc @@ -190,7 +190,7 @@ bool Client::auth(MHD_Connection* connection, const char* url, const char* metho user ? user : "", pw ? "using password" : "no password", method, url); } - send_auth_error(connection); + rval = false; } else if (!admin_user_is_inet_admin(user) && modifies_data(connection, method)) @@ -268,7 +268,7 @@ int handle_client(void *cls, // Authentication has failed, an error will be sent to the client rval = MHD_YES; - if (*upload_data_size) + if (*upload_data_size || (state == Client::INIT && request_data_length(connection))) { // The client is uploading data, discard it so we can send the error *upload_data_size = 0;