From b5c91417ff881b5505fd96dcf603f7604258594e Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 10 Oct 2017 16:59:28 +0200 Subject: [PATCH] Better debug information of each request. --- src/server/kiwix-serve.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index a384bcb..acd3560 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -627,6 +627,13 @@ static struct MHD_Response* handle_default(RequestContext* request_context) content.data(), content.size(), "", mimeType, deflated, true); } +int print_out_key (void *cls, enum MHD_ValueKind kind, + const char *key, const char *value) +{ + printf ("%s: %s\n", key, value); + return MHD_YES; +} + static int accessHandlerCallback(void* cls, struct MHD_Connection* connection, const char* url, @@ -651,9 +658,12 @@ static int accessHandlerCallback(void* cls, /* clear context pointer */ *ptr = NULL; - /* Debug */ if (isVerbose.load()) { - printf("Requesting %s\n", url); + printf("Requesting : \n"); + printf("u : %s\n", url); + printf("m : %s\n", method); + printf("v : %s\n", version); + MHD_get_connection_values (connection, MHD_HEADER_KIND, &print_out_key, NULL); } /* Check if the response can be compressed */