MXS-2575: Fix REST-API error propagation

The errors are now correctly sent even with requests that upload data.
This commit is contained in:
Markus Mäkelä
2019-06-24 14:37:40 +03:00
parent 2f56264715
commit c1c376b7ac

View File

@ -185,7 +185,7 @@ bool Client::auth(MHD_Connection* connection, const char* url, const char* metho
method, method,
url); url);
} }
send_auth_error(connection);
rval = false; rval = false;
} }
else if (modifies_data(method) && !admin_user_is_inet_admin(user, pw)) else if (modifies_data(method) && !admin_user_is_inet_admin(user, pw))
@ -267,7 +267,7 @@ int handle_client(void* cls,
// Authentication has failed, an error will be sent to the client // Authentication has failed, an error will be sent to the client
rval = MHD_YES; 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 // The client is uploading data, discard it so we can send the error
*upload_data_size = 0; *upload_data_size = 0;