diff options
-rw-r--r-- | src/libmime/protocol.c | 6 | ||||
-rw-r--r-- | src/worker.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libmime/protocol.c b/src/libmime/protocol.c index 52336c81c..69d849d52 100644 --- a/src/libmime/protocol.c +++ b/src/libmime/protocol.c @@ -780,8 +780,10 @@ rspamd_protocol_write_reply (struct rspamd_task *task) top = ucl_object_typed_new (UCL_OBJECT); debug_task ("writing reply to client"); if (task->error_code != 0) { - msg->code = task->error_code; - ucl_object_insert_key (top, ucl_object_fromstring (task->last_error), "error", 0, false); + msg->code = 500 + task->error_code % 100; + msg->status = g_string_new (task->last_error); + ucl_object_insert_key (top, ucl_object_fromstring (task->last_error), + "error", 0, false); msg->body = g_string_sized_new (256); rspamd_ucl_emit_gstring (top, UCL_EMIT_JSON_COMPACT, msg->body); ucl_object_unref (top); diff --git a/src/worker.c b/src/worker.c index aca667a68..20945bd89 100644 --- a/src/worker.c +++ b/src/worker.c @@ -142,7 +142,7 @@ rspamd_worker_error_handler (struct rspamd_http_connection *conn, GError *err) if (task->state != CLOSING_CONNECTION) { /* We still need to write a reply */ task->error_code = err->code; - task->last_error = err->message; + task->last_error = rspamd_mempool_strdup (task->task_pool, err->message); task->state = WRITE_REPLY; rspamd_protocol_write_reply (task); } |