diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-18 10:29:14 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-18 10:29:14 +0200 |
commit | b8d07fe6b46b006fba6aa338ed3a72ac4c85b250 (patch) | |
tree | c884d31c06dd38434d8fefe6dd0d1960ce71f3da | |
parent | 28b03c5be7aa0afa33c702111773f04b24820631 (diff) | |
download | twister-b8d07fe6b46b006fba6aa338ed3a72ac4c85b250.tar.gz twister-b8d07fe6b46b006fba6aa338ed3a72ac4c85b250.tar.bz2 twister-b8d07fe6b46b006fba6aa338ed3a72ac4c85b250.zip |
do not rely on taler-util header
-rw-r--r-- | src/twister/taler-twister-service.c | 120 |
1 files changed, 59 insertions, 61 deletions
diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c index e08d58b..1912d78 100644 --- a/src/twister/taler-twister-service.c +++ b/src/twister/taler-twister-service.c @@ -40,19 +40,17 @@ #include "twister.h" #include <jansson.h> #include <microhttpd.h> -#include <taler/taler_util.h> #include <zlib.h> -/** - * To be removed upon the next release. - */ -#ifndef TALER_LOG_INFO - -#define TALER_LOG_INFO(...) \ +#define TWISTER_LOG_INFO(...) \ GNUNET_log (GNUNET_ERROR_TYPE_INFO, __VA_ARGS__) - -#endif +#define TWISTER_LOG_DEBUG(...) \ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) +#define TWISTER_LOG_WARNING(...) \ + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, __VA_ARGS__) +#define TWISTER_LOG_ERROR(...) \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, __VA_ARGS__) #define REQUEST_BUFFER_MAX (1024 * 1024) #define UNIX_BACKLOG 500 @@ -447,9 +445,9 @@ curl_check_hdr (void *buffer, if (NULL != (tok = strchr (hdr_val, '\t'))) *tok = '\0'; - TALER_LOG_DEBUG ("Parsed line: '%s: %s'\n", - hdr_type, - hdr_val); + TWISTER_LOG_DEBUG ("Parsed line: '%s: %s'\n", + hdr_type, + hdr_val); /* Skip "Content-length:" header as it will be wrong, given that we are man-in-the-middling the connection */ @@ -955,15 +953,15 @@ con_val_iter (void *cls, (0 == strcmp (MHD_HTTP_HEADER_CONTENT_ENCODING, key))) { - TALER_LOG_INFO ("Do not re-compress request and/or do not" - " ask for compressed responses\n"); + TWISTER_LOG_INFO ("Do not re-compress request and/or do not" + " ask for compressed responses\n"); return MHD_YES; } if ((0 == strcmp (MHD_HTTP_HEADER_CONTENT_LENGTH, key))) { - TALER_LOG_INFO ( + TWISTER_LOG_INFO ( "Do not re-set Content-Length for request (CURLOPT_POSTFIELDSIZE did)\n"); return MHD_YES; } @@ -1021,15 +1019,15 @@ walk_object (const char *path, token = strtok (path_dup, "."); if (NULL == (element = json)) { - TALER_LOG_ERROR ("Attempting to walk a non JSON response!\n"); + TWISTER_LOG_ERROR ("Attempting to walk a non JSON response!\n"); return GNUNET_SYSERR; } while (last_token != token) { - TALER_LOG_DEBUG ("token/last_token: %s@%p / %s@%p\n", - token, token, - last_token, last_token); + TWISTER_LOG_DEBUG ("token/last_token: %s@%p / %s@%p\n", + token, token, + last_token, last_token); if (NULL == token) return GNUNET_SYSERR; // path was ".", refuse to process it. if (NULL != (cur = json_object_get (element, @@ -1047,8 +1045,8 @@ walk_object (const char *path, token = strtok (NULL, "."); continue; } - TALER_LOG_WARNING ("Path token '%s' not found\n", - token); + TWISTER_LOG_WARNING ("Path token '%s' not found\n", + token); GNUNET_free (path_dup); return GNUNET_NO; } @@ -1062,8 +1060,8 @@ walk_object (const char *path, * same random array element. */(NULL == json_array_get (element, (unsigned int) strtoul (token, NULL, 10))) ) { - TALER_LOG_WARNING ("(Last) path token '%s' not found\n", - last_token); + TWISTER_LOG_WARNING ("(Last) path token '%s' not found\n", + last_token); GNUNET_free (path_dup); return GNUNET_NO; } @@ -1101,8 +1099,8 @@ modify_object (struct MHD_Connection *con, &target, json)) { - TALER_LOG_INFO ("Path (%s) was not found on this object\n", - path); + TWISTER_LOG_INFO ("Path (%s) was not found on this object\n", + path); return GNUNET_NO; } @@ -1110,7 +1108,7 @@ modify_object (struct MHD_Connection *con, if (0 == strcmp ("true", modify_value)) { - TALER_LOG_DEBUG ("New value parsed as boolean true\n"); + TWISTER_LOG_DEBUG ("New value parsed as boolean true\n"); new_value = json_true (); goto perform_modbody; } @@ -1120,18 +1118,18 @@ modify_object (struct MHD_Connection *con, | JSON_DISABLE_EOF_CHECK, &error))) { - TALER_LOG_DEBUG ("New value parsed as object/array\n"); + TWISTER_LOG_DEBUG ("New value parsed as object/array\n"); goto perform_modbody; } if (NULL != (new_value = json_string (modify_value))) { - TALER_LOG_DEBUG ("New value parsed as string\n"); + TWISTER_LOG_DEBUG ("New value parsed as string\n"); goto perform_modbody; } - TALER_LOG_ERROR ("Invalid new value given: %s\n", - modify_value); + TWISTER_LOG_ERROR ("Invalid new value given: %s\n", + modify_value); GNUNET_free (target); return GNUNET_SYSERR; @@ -1152,7 +1150,7 @@ perform_modbody: if (-1 == ret_modify) { - TALER_LOG_WARNING ("Could not replace '%s'\n", target); + TWISTER_LOG_WARNING ("Could not replace '%s'\n", target); return GNUNET_SYSERR; } @@ -1194,8 +1192,8 @@ flip_object (struct MHD_Connection *con, * Not an error, as the user can "batch" * requests until the right object gets in the way. */ - TALER_LOG_INFO ("Path (%s) was not found on this object\n", - flip_path); + TWISTER_LOG_INFO ("Path (%s) was not found on this object\n", + flip_path); return GNUNET_NO; } @@ -1241,14 +1239,14 @@ flip_object (struct MHD_Connection *con, current_value_flip[flip_index] = crockford_chars[crockford_index]; - TALER_LOG_INFO ("Flipping %s to %s\n", - current_value, - current_value_flip); + TWISTER_LOG_INFO ("Flipping %s to %s\n", + current_value, + current_value_flip); if (0 != json_string_set (child, (const char *) current_value_flip)) { - TALER_LOG_WARNING ("Could not flip '%s'\n", target); + TWISTER_LOG_WARNING ("Could not flip '%s'\n", target); GNUNET_free (current_value_flip); GNUNET_free (target); return GNUNET_SYSERR; @@ -1285,8 +1283,8 @@ delete_object (struct MHD_Connection *con, &target, hr->json)) { - TALER_LOG_INFO ("Path (%s) was not found on this object\n", - delete_path); + TWISTER_LOG_INFO ("Path (%s) was not found on this object\n", + delete_path); return GNUNET_NO; } @@ -1307,8 +1305,8 @@ delete_object (struct MHD_Connection *con, if (-1 == ret_deletion) { - TALER_LOG_WARNING ("Could not delete '%s'\n", - target); + TWISTER_LOG_WARNING ("Could not delete '%s'\n", + target); return GNUNET_SYSERR; } return GNUNET_OK; @@ -1425,14 +1423,14 @@ create_response_with_chaos_rate (struct HttpRequest *request) random = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 100); - TALER_LOG_INFO ("p: %llu, random: %llu\n", - (unsigned long long) chaos_rate, - (unsigned long long) random); + TWISTER_LOG_INFO ("p: %llu, random: %llu\n", + (unsigned long long) chaos_rate, + (unsigned long long) random); if (random < chaos_rate) { /* p won */ - TALER_LOG_INFO ("Chaos probability won the case.\n"); + TWISTER_LOG_INFO ("Chaos probability won the case.\n"); resp_buf = "Service unavailable"; resp_len = strlen (resp_buf); request->response_code = MHD_HTTP_SERVICE_UNAVAILABLE; @@ -1574,7 +1572,7 @@ create_response (void *cls, &error); if (NULL == hr->json) { - TALER_LOG_ERROR + TWISTER_LOG_ERROR ("Could not parse JSON from client: %s (%s)\n", error.text, error.source); @@ -1593,7 +1591,7 @@ create_response (void *cls, * body length in the request headers. */ if (GNUNET_YES == malform_upload) { - TALER_LOG_DEBUG + TWISTER_LOG_DEBUG ("Will (badly) truncate the request.\n"); malformed_size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, hr->io_len); @@ -1651,7 +1649,7 @@ create_response (void *cls, hr->curl = curl_easy_init (); if (NULL == hr->curl) { - TALER_LOG_ERROR ("Could not init the curl handle\n"); + TWISTER_LOG_ERROR ("Could not init the curl handle\n"); return MHD_queue_response (con, MHD_HTTP_INTERNAL_SERVER_ERROR, curl_failure_response); @@ -1723,8 +1721,8 @@ create_response (void *cls, GNUNET_free (curlurl); host_hdr = build_host_header (target_server_base_url); - TALER_LOG_DEBUG ("Faking the host header, %s\n", - host_hdr); + TWISTER_LOG_DEBUG ("Faking the host header, %s\n", + host_hdr); hr->headers = curl_slist_append (hr->headers, host_hdr); GNUNET_free (host_hdr); @@ -1852,9 +1850,9 @@ create_response (void *cls, if (NULL != flip_path_dl) { - TALER_LOG_DEBUG ("Will flip path" - " in response: %s\n", - flip_path_dl); + TWISTER_LOG_DEBUG ("Will flip path" + " in response: %s\n", + flip_path_dl); if (GNUNET_OK == flip_object (con, hr->json, @@ -1867,8 +1865,8 @@ create_response (void *cls, if (NULL != delete_path) { - TALER_LOG_DEBUG ("Will delete path: %s\n", - delete_path); + TWISTER_LOG_DEBUG ("Will delete path: %s\n", + delete_path); if (GNUNET_OK == delete_object (con, hr)) { @@ -1881,9 +1879,9 @@ create_response (void *cls, { int ret; - TALER_LOG_DEBUG ("Will modify path: %s to value %s\n", - modify_path_dl, - modify_value); + TWISTER_LOG_DEBUG ("Will modify path: %s to value %s\n", + modify_path_dl, + modify_value); ret = modify_object (con, hr->json, @@ -1921,7 +1919,7 @@ create_response (void *cls, { size_t fake_len; - TALER_LOG_DEBUG + TWISTER_LOG_DEBUG ("Will (badly) truncate the response.\n"); fake_len = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, hr->io_len); @@ -2623,7 +2621,7 @@ handle_malform (void *cls, { struct GNUNET_SERVICE_Client *c = cls; - TALER_LOG_DEBUG ("Flagging response malformation\n"); + TWISTER_LOG_DEBUG ("Flagging response malformation\n"); malform = GNUNET_YES; send_acknowledgement (c); } @@ -2641,7 +2639,7 @@ handle_malform_upload (void *cls, { struct GNUNET_SERVICE_Client *c = cls; - TALER_LOG_DEBUG ("Flagging request malformation\n"); + TWISTER_LOG_DEBUG ("Flagging request malformation\n"); malform_upload = GNUNET_YES; send_acknowledgement (c); } |