Browse Source

[Feature] Use msgpack in the client

pull/4867/head
Vsevolod Stakhov 2 months ago
parent
commit
bc1d4d92f5
No account linked to committer's email address
1 changed files with 11 additions and 4 deletions
  1. 11
    4
      src/client/rspamdclient.c

+ 11
- 4
src/client/rspamdclient.c View File

/*-
* Copyright 2016 Vsevolod Stakhov
/*
* Copyright 2024 Vsevolod Stakhov
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
} }


parser = ucl_parser_new(0); 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", err = g_error_new(RCLIENT_ERROR, msg->code, "Cannot parse UCL: %s",
ucl_parser_get_error(parser)); ucl_parser_get_error(parser));
ucl_parser_free(parser); ucl_parser_free(parser);
rspamd_http_message_add_header(req->msg, "Filename", filename); 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, "/", 1);
req->msg->url = rspamd_fstring_append(req->msg->url, command, strlen(command)); req->msg->url = rspamd_fstring_append(req->msg->url, command, strlen(command));



Loading…
Cancel
Save