]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Write custom status in HTTP reply.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 30 Apr 2014 22:39:36 +0000 (15:39 -0700)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 30 Apr 2014 22:39:36 +0000 (15:39 -0700)
src/libserver/worker_util.c
src/libutil/http.c
src/plugins/fuzzy_check.c

index 173415c4bff1ea200090a638781df49a13328c3d..74a83cb70bf02971253756126b27b80b2cab6df2 100644 (file)
@@ -227,6 +227,7 @@ rspamd_controller_send_error (struct rspamd_http_connection_entry *entry,
        msg->date = time (NULL);
        msg->code = code;
        msg->body = g_string_sized_new (128);
+       msg->status = g_string_new (error_msg);
        rspamd_printf_gstring (msg->body, "{\"error\":\"%s\"}", error_msg);
        rspamd_http_connection_reset (entry->conn);
        rspamd_http_connection_write_message (entry->conn, msg, NULL,
index 1b17b59577be11dc5b3c36648796bd638c1a463a..1ad8cba34cac902f9bca3eb1b9ec35085314f4c3 100644 (file)
@@ -832,7 +832,8 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn,
                                        "Date: %s\r\n"
                                        "Content-Length: %z\r\n"
                                        "Content-Type: %s\r\n",
-                                       msg->code, rspamd_http_code_to_str (msg->code),
+                                       msg->code,
+                                       msg->status ? msg->status->str : rspamd_http_code_to_str (msg->code),
                                        "rspamd/" RVERSION,
                                        datebuf,
                                        bodylen,
index 24f2ec3121f3ec79519da1593d96c0ebc91b86f9..146450528cc15b6abdfd506dad91a45b6ed41311 100644 (file)
@@ -1030,7 +1030,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
        else if (!processed) {
                msg_warn ("processing of message failed");
                rspamd_task_free (task, FALSE);
-               rspamd_controller_send_error (conn_ent, 404, "No fuzzy rules matchedr");
+               rspamd_controller_send_error (conn_ent, 404, "No fuzzy rules matched");
                return;
        }