gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: curl: improve logging on errors


From: gnunet
Subject: [gnunet] branch master updated: curl: improve logging on errors
Date: Tue, 23 Jul 2024 15:41:50 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new d4b05e381 curl: improve logging on errors
d4b05e381 is described below

commit d4b05e38144801f080c28737a8a3fdb508a1413b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Jul 23 15:41:41 2024 +0200

    curl: improve logging on errors
---
 po/POTFILES.in                |  1 +
 src/include/gnunet_curl_lib.h |  3 ---
 src/lib/curl/curl.c           | 33 +++++++++++++++++++--------------
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index cb7b23ed6..cb9f74115 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -181,6 +181,7 @@ src/lib/util/crypto_elligator.c
 src/lib/util/crypto_hash.c
 src/lib/util/crypto_hash_file.c
 src/lib/util/crypto_hkdf.c
+src/lib/util/crypto_hpke.c
 src/lib/util/crypto_kdf.c
 src/lib/util/crypto_mpi.c
 src/lib/util/crypto_paillier.c
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index 967170085..c55b298c5 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -299,9 +299,6 @@ GNUNET_CURL_set_tlscert (struct GNUNET_CURL_Context *ctx,
  * completion.  Note that the context will make use of the CURLOPT_PRIVATE
  * facility of the CURL @a eh.
  *
- * This function modifies the CURL handle to add the
- * "Content-Type: application/json" header if @a add_json is set.
- *
  * @param ctx context to execute the job in
  * @param eh curl easy handle for the request, will
  *           be executed AND cleaned up
diff --git a/src/lib/curl/curl.c b/src/lib/curl/curl.c
index 648c9a14e..80ff1f179 100644
--- a/src/lib/curl/curl.c
+++ b/src/lib/curl/curl.c
@@ -45,23 +45,23 @@
  * @param code what was the curl error code
  */
 #define CURL_STRERROR(type, function, code)                                \
-  GNUNET_log (type,                                                        \
-              "Curl function `%s' has failed at `%s:%d' with error: %s\n", \
-              function,                                                    \
-              __FILE__,                                                    \
-              __LINE__,                                                    \
-              curl_easy_strerror (code));
+        GNUNET_log (type,                                                      
  \
+                    "Curl function `%s' has failed at `%s:%d' with error: 
%s\n", \
+                    function,                                                  
  \
+                    __FILE__,                                                  
  \
+                    __LINE__,                                                  
  \
+                    curl_easy_strerror (code));
 
 /**
  * Print JSON parsing related error information
  */
 #define JSON_WARN(error)                                 \
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                 \
-              "JSON parsing failed at %s:%u: %s (%s)\n", \
-              __FILE__,                                  \
-              __LINE__,                                  \
-              error.text,                                \
-              error.source)
+        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                 \
+                    "JSON parsing failed at %s:%u: %s (%s)\n", \
+                    __FILE__,                                  \
+                    __LINE__,                                  \
+                    error.text,                                \
+                    error.source)
 
 
 /**
@@ -567,7 +567,8 @@ GNUNET_CURL_job_add_with_ct_json (struct 
GNUNET_CURL_Context *ctx,
 
   GNUNET_assert (NULL != (job_headers =
                             curl_slist_append (NULL,
-                                               "Content-Type: 
application/json")));
+                                               "Content-Type: 
application/json")
+                          ));
   job = GNUNET_CURL_job_add2 (ctx,
                               eh,
                               job_headers,
@@ -651,7 +652,6 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
                                   long *response_code)
 {
   json_t *json;
-  json_error_t error;
   char *ct;
 
 #if DEBUG
@@ -713,6 +713,8 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
   json = NULL;
   if (0 == db->eno)
   {
+    json_error_t error;
+
     json = json_loadb (db->buf,
                        db->buf_size,
                        JSON_REJECT_DUPLICATES | JSON_DISABLE_EOF_CHECK,
@@ -721,6 +723,9 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
     {
       JSON_WARN (error);
       *response_code = 0;
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Failed to parse JSON response: %s\n",
+                  error.text);
     }
   }
   GNUNET_free (db->buf);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]