summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-18 11:27:22 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-18 11:27:22 +0200
commit78494c15b16f1c64496642479ab54017b3750b64 (patch)
tree80f3b3678af9a9d99494ea56063d303bf2b02dc0 /src/backend
parent2a53e1758257b1af89e085511e4e7eba809ed84e (diff)
downloadanastasis-78494c15b16f1c64496642479ab54017b3750b64.tar.gz
anastasis-78494c15b16f1c64496642479ab54017b3750b64.tar.bz2
anastasis-78494c15b16f1c64496642479ab54017b3750b64.zip
-improve logging'
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/anastasis-httpd.c29
-rw-r--r--src/backend/anastasis-httpd.h5
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
@@ -129,6 +129,11 @@ struct TM_HandlerContext
const struct AH_RequestHandler *rh;
/**
+ * URL requested by the client, for logging.
+ */
+ const char *url;
+
+ /**
* Asynchronous request context id.
*/
struct GNUNET_AsyncScopeId async_scope_id;