gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -improve logging if there is no HTTP res


From: gnunet
Subject: [gnunet] branch master updated: -improve logging if there is no HTTP response
Date: Fri, 30 Jul 2021 15:29:18 +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 e8eb1ecc0 -improve logging if there is no HTTP response
e8eb1ecc0 is described below

commit e8eb1ecc006ffd3d7aa99fc9d3e8d19eedd9d343
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jul 30 14:17:30 2021 +0200

    -improve logging if there is no HTTP response
---
 src/curl/curl.c               | 21 ++++++++++++++++++---
 src/include/gnunet_curl_lib.h |  2 +-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/curl/curl.c b/src/curl/curl.c
index b6aef4f61..79aac74ce 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -784,6 +784,20 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
                   (const char *) db->buf);
     return NULL;
   }
+  if (0 == *response_code)
+  {
+    char *url;
+
+    if (CURLE_OK !=
+        curl_easy_getinfo (eh,
+                           CURLINFO_EFFECTIVE_URL,
+                           &url))
+      url = "<unknown URL>";
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Failed to download response from `%s': \n",
+                url);
+    return NULL;
+  }
   if (MHD_HTTP_NO_CONTENT == *response_code)
     return NULL;
   json = NULL;
@@ -825,8 +839,9 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
  * @param header header string; will be given to the context AS IS.
  * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise.
  */
-int
-GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, const char *header)
+enum GNUNET_GenericReturnValue
+GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx,
+                           const char *header)
 {
   ctx->common_headers = curl_slist_append (ctx->common_headers, header);
   if (NULL == ctx->common_headers)
@@ -892,7 +907,7 @@ do_benchmark (CURLMsg *cmsg)
      curl -w "foo%{size_request} -XPOST --data "ABC" $URL
      the CURLINFO_REQUEST_SIZE should be the whole size of the request
      including headers and body.
-  *///
+  */
   GNUNET_break (size_curl <= size_long);
 
   urd = get_url_benchmark_data (url, (unsigned int) response_code);
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index f51e4b503..38acecc48 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -150,7 +150,7 @@ GNUNET_CURL_get_select_info (struct GNUNET_CURL_Context 
*ctx,
  * @param header header string; will be given to the context AS IS.
  * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise.
  */
-int
+enum GNUNET_GenericReturnValue
 GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx,
                            const char *header);
 

-- 
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]