]> source.dussan.org Git - rspamd.git/commitdiff
Fix ping command.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Nov 2014 14:55:50 +0000 (14:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Nov 2014 14:55:50 +0000 (14:55 +0000)
src/libserver/protocol.c
src/worker.c

index 726da91181a7c64b9fcbbe320419f787796f7daa..f4e8da09d953d3d033c413e71950720cbac76ce6 100644 (file)
@@ -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");
index 4bca03f2df3b6639175f87de56540a4e41eddac7..aff9c1b0012bf00041b033a1f470b848bfe5013b 100644 (file)
@@ -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;
        }