anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit 78494c15b16f1c64496642479ab54017b3750b64
parent 2a53e1758257b1af89e085511e4e7eba809ed84e
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 18 Aug 2021 11:27:22 +0200

-improve logging'

Diffstat:
Msrc/backend/anastasis-httpd.c | 29++++++++++++++++++++++++++---
Msrc/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 @@ -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 @@ -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;