diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-22 12:51:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-22 12:51:20 +0100 |
commit | 42228b92e57e27a5af566496bd585afde5cbb07c (patch) | |
tree | 01968609d6c1eb6b2fdb2b4ab6e9c03f4ec404e8 /src | |
parent | 2ea40ec56af673b2aec231e7454a27e29fe39126 (diff) | |
download | rspamd-42228b92e57e27a5af566496bd585afde5cbb07c.tar.gz rspamd-42228b92e57e27a5af566496bd585afde5cbb07c.zip |
[Minor] Rspamc: Detect zstd input automatically
Diffstat (limited to 'src')
-rw-r--r-- | src/client/rspamdclient.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c index bcb25672e..9a2e7f88d 100644 --- a/src/client/rspamdclient.c +++ b/src/client/rspamdclient.c @@ -372,6 +372,10 @@ rspamd_client_command (struct rspamd_client_connection *conn, } if (!compressed) { + /* Detect zstd input */ + if (input->len > 4 && memcmp (input->str, "\x28\xb5\x2f\xfd", 4) == 0) { + compressed = TRUE; + } body = rspamd_fstring_new_init (input->str, input->len); } else { @@ -391,18 +395,6 @@ rspamd_client_command (struct rspamd_client_connection *conn, } dict_id = -1; - - if (dict_id == 0) { - g_set_error (err, RCLIENT_ERROR, errno, - "cannot open dictionary %s: %s", - comp_dictionary, - strerror (errno)); - g_free (req); - g_string_free (input, TRUE); - munmap (dict, dict_len); - - return FALSE; - } } body = rspamd_fstring_sized_new (ZSTD_compressBound (input->len)); |