gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: -improve logging'


From: gnunet
Subject: [taler-anastasis] branch master updated: -improve logging'
Date: Wed, 18 Aug 2021 11:27:24 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 78494c1  -improve logging'
78494c1 is described below

commit 78494c15b16f1c64496642479ab54017b3750b64
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Aug 18 11:27:22 2021 +0200

    -improve logging'
---
 src/backend/anastasis-httpd.c | 29 ++++++++++++++++++++++++++---
 src/backend/anastasis-httpd.h |  5 +++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index fd5ffc3..35a4d9c 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -332,6 +332,7 @@ url_handler (void *cls,
     hc = GNUNET_new (struct TM_HandlerContext);
     *con_cls = hc;
     hc->async_scope_id = aid;
+    hc->url = url;
   }
   if (0 == strcasecmp (method,
                        MHD_HTTP_METHOD_HEAD))
@@ -519,14 +520,36 @@ handle_mhd_completion_callback (void *cls,
                                 enum MHD_RequestTerminationCode toe)
 {
   struct TM_HandlerContext *hc = *con_cls;
+  struct GNUNET_AsyncScopeSave old_scope;
 
   (void) cls;
   (void) connection;
   if (NULL == hc)
     return;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Finished handling request with status %d\n",
-              (int) toe);
+  GNUNET_async_scope_enter (&hc->async_scope_id,
+                            &old_scope);
+  {
+#if MHD_VERSION >= 0x00097304
+    const union MHD_ConnectionInfo *ci;
+    unsigned int http_status = 0;
+
+    ci = MHD_get_connection_info (connection,
+                                  MHD_CONNECTION_INFO_HTTP_STATUS);
+    if (NULL != ci)
+      http_status = ci->http_status;
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Request for `%s' completed with HTTP status %u (%d)\n",
+                hc->url,
+                http_status,
+                toe);
+#else
+    (void) connection;
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Request for `%s' completed (%d)\n",
+                hc->url,
+                toe);
+#endif
+  }
   if (NULL != hc->cc)
     hc->cc (hc);
   GNUNET_free (hc);
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index b3d2b54..b84088d 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -128,6 +128,11 @@ struct TM_HandlerContext
    */
   const struct AH_RequestHandler *rh;
 
+  /**
+   * URL requested by the client, for logging.
+   */
+  const char *url;
+
   /**
    * Asynchronous request context id.
    */

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