diff options
Diffstat (limited to 'src/auditor/taler-auditor-httpd_row-inconsistency-get.c')
-rw-r--r-- | src/auditor/taler-auditor-httpd_row-inconsistency-get.c | 91 |
1 files changed, 35 insertions, 56 deletions
diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c index f2c70a843..a2fa543ea 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -31,10 +43,8 @@ add_row_inconsistency (void *cls, json_t *list = cls; json_t *obj; - printf ("checkpoint pg_3\n"); - obj = GNUNET_JSON_PACK ( - // TODO: is it string? + GNUNET_JSON_pack_string ("row_table", dc->row_table), GNUNET_JSON_pack_string ("diagnostic", @@ -44,8 +54,6 @@ add_row_inconsistency (void *cls, json_array_append_new (list, obj)); - printf ("checkpoint pg_4\n"); - return GNUNET_OK; } @@ -87,58 +95,29 @@ TAH_ROW_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, ja = json_array (); GNUNET_break (NULL != ja); - int64_t limit = -20; - uint64_t offset; - - TALER_MHD_parse_request_snumber (connection, - "limit", - &limit); - - if (limit < 0) - offset = INT64_MAX; - else - offset = 0; - - TALER_MHD_parse_request_number (connection, - "offset", - &offset); + int64_t limit = -20; + uint64_t offset; - bool return_suppressed = false; + TALER_MHD_parse_request_snumber (connection, + "limit", + &limit); - struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_bool ("return_suppressed", &return_suppressed), - GNUNET_JSON_spec_end () - }; + if (limit < 0) + offset = INT64_MAX; + else + offset = 0; + TALER_MHD_parse_request_number (connection, + "offset", + &offset); - // read the input json - json_t *json_in; + bool return_suppressed = false; + const char *ret_s = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "return_suppressed"); + if (ret_s != NULL && strcmp (ret_s, "true") == 0) { - enum GNUNET_GenericReturnValue res; - - res = TALER_MHD_parse_post_json (connection, - connection_cls, - upload_data, - upload_data_size, - &json_in); - if (GNUNET_SYSERR == res) - return MHD_NO; - if ((GNUNET_NO == res) || - (NULL == json_in)) - return MHD_YES; - res = TALER_MHD_parse_json_data (connection, - json_in, - spec); - if (GNUNET_SYSERR == res) - { - json_decref (json_in); - return MHD_NO; /* hard failure */ - } - if (GNUNET_NO == res) - { - json_decref (json_in); - return MHD_YES; /* failure */ - } + return_suppressed = true; } qs = TAH_plugin->get_row_inconsistency ( @@ -163,6 +142,6 @@ TAH_ROW_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, return TALER_MHD_REPLY_JSON_PACK ( connection, MHD_HTTP_OK, - GNUNET_JSON_pack_array_steal ("row-inconsistency", + GNUNET_JSON_pack_array_steal ("row_inconsistency", ja)); }
\ No newline at end of file |