diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-03-12 14:55:53 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-03-12 14:55:53 +0000 |
commit | bc1d4d92f59aab0b218dccdb93b56a2ed5392ef1 (patch) | |
tree | e5d629f7e4c2ebc113af8d8932ae3d6b58098ed0 | |
parent | fa45782ada5d6074e74f5690994a00437965d3d2 (diff) | |
download | rspamd-bc1d4d92f59aab0b218dccdb93b56a2ed5392ef1.tar.gz rspamd-bc1d4d92f59aab0b218dccdb93b56a2ed5392ef1.zip |
[Feature] Use msgpack in the client
-rw-r--r-- | src/client/rspamdclient.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c index 85f4749f1..e77f662eb 100644 --- a/src/client/rspamdclient.c +++ b/src/client/rspamdclient.c @@ -1,11 +1,11 @@ -/*- - * Copyright 2016 Vsevolod Stakhov +/* + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -232,7 +232,9 @@ rspamd_client_finish_handler(struct rspamd_http_connection *conn, } parser = ucl_parser_new(0); - if (!ucl_parser_add_chunk(parser, start, len)) { + if (!ucl_parser_add_chunk_full(parser, start, len, + ucl_parser_get_default_priority(parser), + UCL_DUPLICATE_APPEND, UCL_PARSE_AUTO)) { err = g_error_new(RCLIENT_ERROR, msg->code, "Cannot parse UCL: %s", ucl_parser_get_error(parser)); ucl_parser_free(parser); @@ -454,6 +456,11 @@ rspamd_client_command(struct rspamd_client_connection *conn, rspamd_http_message_add_header(req->msg, "Filename", filename); } + /* + * Allow messagepack reply if supported + */ + rspamd_http_message_add_header(req->msg, "Accept", "application/msgpack"); + req->msg->url = rspamd_fstring_append(req->msg->url, "/", 1); req->msg->url = rspamd_fstring_append(req->msg->url, command, strlen(command)); |