From afd505282b65a900b99113138e63fad6193ed3c9 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 28 Nov 2011 17:52:16 +0300 Subject: [PATCH] Fix log_urls setting. --- src/kvstorage_server.c | 2 +- src/protocol.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/kvstorage_server.c b/src/kvstorage_server.c index 0eba6fcff..683c5a2e4 100644 --- a/src/kvstorage_server.c +++ b/src/kvstorage_server.c @@ -966,7 +966,7 @@ thr_accept_socket (gint fd, short what, void *arg) return; } - session = g_slice_alloc (sizeof (struct kvstorage_session)); + session = g_slice_alloc0 (sizeof (struct kvstorage_session)); session->pool = memory_pool_new (memory_pool_get_size ()); session->state = KVSTORAGE_STATE_READ_CMD; session->thr = thr; diff --git a/src/protocol.c b/src/protocol.c index 73f8b9de6..70ba1bd83 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -651,6 +651,7 @@ struct tree_cb_data { gchar *buf; gsize len; gsize off; + struct worker_task *task; }; /* @@ -672,6 +673,12 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) cb->off += rspamd_snprintf (cb->buf + cb->off, cb->len - cb->off, " %*s,", url->hostlen, url->host); } + + if (cb->task->cfg->log_urls) { + msg_info ("<%s> URL: %s - %s: %s", cb->task->message_id, cb->task->user ? + cb->task->user : "unknown", inet_ntoa (cb->task->client_addr), struri (url)); + } + return FALSE; } @@ -687,6 +694,7 @@ show_url_header (struct worker_task *task) cb.buf = outbuf; cb.len = sizeof (outbuf); cb.off = r; + cb.task = task; g_tree_foreach (task->urls, urls_protocol_cb, &cb); /* Strip last ',' */ @@ -736,6 +744,7 @@ show_email_header (struct worker_task *task) cb.buf = outbuf; cb.len = sizeof (outbuf); cb.off = r; + cb.task = task; g_tree_foreach (task->emails, emails_protocol_cb, &cb); /* Strip last ',' */ -- 2.39.5