From: Vsevolod Stakhov Date: Wed, 30 Apr 2014 22:39:36 +0000 (-0700) Subject: Write custom status in HTTP reply. X-Git-Tag: 0.7.0~246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d5515412fa359e98e9a92350004abffda183909;p=thirdparty%2Frspamd.git Write custom status in HTTP reply. --- diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index 173415c4bf..74a83cb70b 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -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, diff --git a/src/libutil/http.c b/src/libutil/http.c index 1b17b59577..1ad8cba34c 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -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, diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 24f2ec3121..146450528c 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -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; }