From eb976e4166e51854f056fd84be68b77d6c616fcd Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 18 Nov 2014 14:55:50 +0000 Subject: [PATCH] Fix ping command. --- src/libserver/protocol.c | 3 ++- src/worker.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 726da9118..f4e8da09d 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -906,7 +906,8 @@ rspamd_protocol_write_reply (struct rspamd_task *task) rspamd_protocol_http_reply (msg, task); break; case CMD_PING: - msg->body = g_string_new ("pong"); + msg->body = g_string_new ("pong" CRLF); + ctype = "text/plain"; break; case CMD_OTHER: msg_err ("BROKEN"); diff --git a/src/worker.c b/src/worker.c index 4bca03f2d..aff9c1b00 100644 --- a/src/worker.c +++ b/src/worker.c @@ -109,6 +109,11 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn, ctx = task->worker->ctx; + if (!rspamd_protocol_handle_request (task, msg)) { + task->state = WRITE_REPLY; + return 0; + } + if (task->cmd == CMD_PING) { task->state = WRITE_REPLY; return 0; @@ -122,11 +127,6 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn, return 0; } - if (!rspamd_protocol_handle_request (task, msg)) { - task->state = WRITE_REPLY; - return 0; - } - if (!rspamd_task_process (task, msg, ctx->classify_pool, TRUE)) { task->state = WRITE_REPLY; } -- 2.39.5