From 80327a52571cc68cfc23ea9ef086a4b5334b5d00 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 31 Aug 2015 11:31:56 +0200 Subject: [PATCH] Facility disable/logging of POSTed content PAZ-1027 Log level "post" controls whether POSTed content is logged. This is enabled by default. To disable, use -v -post on the command line. --- src/http.c | 9 ++++++--- src/pazpar2.c | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/http.c b/src/http.c index 1bbd4a1..e6d883a 100644 --- a/src/http.c +++ b/src/http.c @@ -81,6 +81,7 @@ struct http_buf struct http_buf *next; }; +static int log_level_post = 0; static void proxy_io(IOCHAN i, int event); static struct http_channel *http_channel_create(http_server_t http_server, @@ -959,8 +960,8 @@ static void http_io(IOCHAN i, int event) hc->request->path, *hc->request->search ? "?" : "", hc->request->search); - if (hc->request->content_buf) - yaz_log(YLOG_LOG, "%s", hc->request->content_buf); + if (hc->request->content_buf && log_level_post) + yaz_log(log_level_post, "%s", hc->request->content_buf); if (http_weshouldproxy(hc->request)) http_proxy(hc->request); else @@ -1452,8 +1453,10 @@ http_server_t http_server_create(void) hs->proxy_addr = 0; hs->ref_count = 1; hs->http_sessions = 0; - hs->record_file = 0; + + log_level_post = yaz_log_module_level("post"); + return hs; } diff --git a/src/pazpar2.c b/src/pazpar2.c index b3928aa..d56daba 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -120,6 +120,7 @@ static int sc_main( #endif yaz_log_init_prefix("pazpar2"); + yaz_log_init_level(yaz_log_mask_str("post")); yaz_log_xml_errors(0, YLOG_WARN); yaz_enable_panic_backtrace(argv[0]); -- 1.7.10.4