}
else if ((guint)r >= sizeof (struct rspamd_fuzzy_cmd)) {
/* Check shingles count sanity */
+ session.legacy = FALSE;
cmd = (struct rspamd_fuzzy_cmd *)buf;
if (!rspamd_fuzzy_command_valid (cmd, r)) {
/* Bad input */
buf.begin = text_part->content->data;
buf.len = text_part->content->len;
buf.size = buf.len;
+ token.begin = NULL;
+ token.len = 0;
text_part->words = g_array_new (FALSE, FALSE, sizeof (rspamd_fstring_t));
while ((pos = rspamd_tokenizer_get_word (&buf,
blake2b_state st;
rspamd_fstring_t *word;
- if (legacy || part->words == NULL) {
+ if (legacy || part->words == NULL || part->words->len == 0) {
cmd = rspamd_mempool_alloc0 (pool, sizeof (*cmd));
cmd->shingles_count = 0;
}
else {
rspamd_upstream_ok (session->server);
- if (session->commands->len == 0) {
- /*
- * All requests are processed now
- */
- remove_normal_event (session->task->s, fuzzy_io_fin, session);
- }
+ remove_normal_event (session->task->s, fuzzy_io_fin, session);
}
}
rspamd_upstream_ok (session->server);
}
- if (ret == -1 || session->commands->len == 0) {
- (*session->saved) --;
- rspamd_http_connection_unref (session->http_entry->conn);
- event_del (&session->ev);
- close (session->fd);
- }
+ (*session->saved) --;
+ rspamd_http_connection_unref (session->http_entry->conn);
+ event_del (&session->ev);
+ close (session->fd);
if (*session->saved == 0) {
if (*(session->err) != NULL) {