aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/buffer.c18
-rw-r--r--src/buffer.h2
-rw-r--r--src/controller.c52
-rw-r--r--src/lmtp.c2
-rw-r--r--src/lmtp_proto.c16
-rw-r--r--src/plugins/emails.c2
-rw-r--r--src/plugins/surbl.c27
-rw-r--r--src/protocol.c26
-rw-r--r--src/url.h3
9 files changed, 83 insertions, 65 deletions
diff --git a/src/buffer.c b/src/buffer.c
index bff75fc39..f8d027307 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -375,15 +375,23 @@ rspamd_set_dispatcher_policy (rspamd_io_dispatcher_t *d,
void
rspamd_dispatcher_write (rspamd_io_dispatcher_t *d,
void *data,
- size_t len, gboolean delayed)
+ size_t len, gboolean delayed, gboolean allocated)
{
rspamd_buffer_t *newbuf;
newbuf = memory_pool_alloc (d->pool, sizeof (rspamd_buffer_t));
- newbuf->data = fstralloc (d->pool, len);
-
- /* We need to copy data to temporary internal buffer to avoid using of stack variables */
- memcpy (newbuf->data->begin, data, len);
+ if (!allocated) {
+ newbuf->data = fstralloc (d->pool, len);
+
+ /* We need to copy data to temporary internal buffer to avoid using of stack variables */
+ memcpy (newbuf->data->begin, data, len);
+ }
+ else {
+ newbuf->data = memory_pool_alloc (d->pool, sizeof (f_str_t));
+ newbuf->data->begin = data;
+ newbuf->data->size = len;
+ }
+
newbuf->pos = newbuf->data->begin;
newbuf->data->len = len;
diff --git a/src/buffer.h b/src/buffer.h
index 4c9e5c905..458ea32de 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -83,7 +83,7 @@ void rspamd_set_dispatcher_policy (rspamd_io_dispatcher_t *d,
*/
void rspamd_dispatcher_write (rspamd_io_dispatcher_t *d,
void *data,
- size_t len, gboolean delayed);
+ size_t len, gboolean delayed, gboolean allocated);
/**
* Pause IO events on dispatcher
diff --git a/src/controller.c b/src/controller.c
index e45075f9e..4b0f7ae63 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -144,7 +144,7 @@ check_auth (struct controller_command *cmd, struct controller_session *session)
if (cmd->privilleged && !session->authorized) {
r = snprintf (out_buf, sizeof (out_buf), "not authorized" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return 0;
}
@@ -161,7 +161,7 @@ counter_write_callback (gpointer key, gpointer value, void *data)
int r;
r = snprintf (out_buf, sizeof (out_buf), "%s: %llu" CRLF, name, (unsigned long long int)cd->value);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, TRUE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, TRUE, FALSE);
}
static void
@@ -182,23 +182,23 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
if (!arg || *arg == '\0') {
msg_debug ("process_command: empty password passed");
r = snprintf (out_buf, sizeof (out_buf), "password command requires one argument" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
if (password == NULL) {
r = snprintf (out_buf, sizeof (out_buf), "password command disabled in config, authorized access unallowed" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
if (strncmp (arg, password, strlen (arg)) == 0) {
session->authorized = 1;
r = snprintf (out_buf, sizeof (out_buf), "password accepted" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
}
else {
session->authorized = 0;
r = snprintf (out_buf, sizeof (out_buf), "password NOT accepted" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
}
break;
case COMMAND_QUIT:
@@ -207,7 +207,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
case COMMAND_RELOAD:
if (check_auth (cmd, session)) {
r = snprintf (out_buf, sizeof (out_buf), "reload request sent" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
kill (getppid (), SIGHUP);
}
break;
@@ -236,13 +236,13 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
(long int)mem_st.chunks_freed);
r += snprintf (out_buf + r, sizeof (out_buf) - r, "Oversized chunks: %ld" CRLF,
(long int)mem_st.oversized_chunks);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
}
break;
case COMMAND_SHUTDOWN:
if (check_auth (cmd, session)) {
r = snprintf (out_buf, sizeof (out_buf), "shutdown request sent" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
kill (getppid (), SIGTERM);
}
break;
@@ -273,7 +273,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
minutes, minutes > 1 ? "s" : " ",
(int)uptime, uptime > 1 ? "s" : " ");
}
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
}
break;
case COMMAND_LEARN:
@@ -282,28 +282,28 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
if (!arg || *arg == '\0') {
msg_debug ("process_command: no statfile specified in learn command");
r = snprintf (out_buf, sizeof (out_buf), "learn command requires at least two arguments: stat filename and its size" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
arg = *(cmd_args + 1);
if (arg == NULL || *arg == '\0') {
msg_debug ("process_command: no statfile size specified in learn command");
r = snprintf (out_buf, sizeof (out_buf), "learn command requires at least two arguments: stat filename and its size" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
size = strtoul (arg, &err_str, 10);
if (err_str && *err_str != '\0') {
msg_debug ("process_command: statfile size is invalid: %s", arg);
r = snprintf (out_buf, sizeof (out_buf), "learn size is invalid" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
statfile = g_hash_table_lookup (session->cfg->statfiles, *cmd_args);
if (statfile == NULL) {
r = snprintf (out_buf, sizeof (out_buf), "statfile %s is not defined" CRLF, *cmd_args);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
@@ -331,7 +331,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
arg = *(cmd_args + 1);
if (!arg || *arg == '\0') {
r = snprintf (out_buf, sizeof (out_buf), "recipient is not defined" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
session->learn_rcpt = memory_pool_strdup (session->session_pool, arg);
@@ -340,7 +340,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
arg = *(cmd_args + 1);
if (!arg || *arg == '\0') {
r = snprintf (out_buf, sizeof (out_buf), "from is not defined" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
session->learn_from = memory_pool_strdup (session->session_pool, arg);
@@ -350,7 +350,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
break;
default:
r = snprintf (out_buf, sizeof (out_buf), "tokenizer is not defined" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
}
@@ -362,12 +362,12 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
if (statfile_pool_create (session->worker->srv->statfile_pool,
session->learn_filename, statfile->size / sizeof (struct stat_file_block)) == -1) {
r = snprintf (out_buf, sizeof (out_buf), "cannot create statfile %s" CRLF, session->learn_filename);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
if (statfile_pool_open (session->worker->srv->statfile_pool, session->learn_filename) == -1) {
r = snprintf (out_buf, sizeof (out_buf), "cannot open statfile %s" CRLF, session->learn_filename);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
return;
}
}
@@ -386,7 +386,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
" stat - show different rspamd stat" CRLF
" counters - show rspamd counters" CRLF
" uptime - rspamd uptime" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE);
break;
case COMMAND_COUNTERS:
rspamd_hash_foreach (counters, counter_write_callback, session);
@@ -422,12 +422,12 @@ controller_read_socket (f_str_t *in, void *arg)
case 0:
msg_debug ("Unknown command: '%s'", cmd);
i = snprintf (out_buf, sizeof (out_buf), "Unknown command" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE);
break;
default:
msg_debug ("Ambigious command: '%s'", cmd);
i = snprintf (out_buf, sizeof (out_buf), "Ambigious command" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE);
break;
}
}
@@ -435,7 +435,7 @@ controller_read_socket (f_str_t *in, void *arg)
session->state = STATE_REPLY;
}
if (session->state != STATE_LEARN) {
- rspamd_dispatcher_write (session->dispatcher, END, sizeof (END) - 1, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, END, sizeof (END) - 1, FALSE, TRUE);
}
g_strfreev (params);
@@ -449,7 +449,7 @@ controller_read_socket (f_str_t *in, void *arg)
if (!session->learn_tokenizer->tokenize_func (session->learn_tokenizer,
session->session_pool, &c, &tokens)) {
i = snprintf (out_buf, sizeof (out_buf), "learn fail, tokenizer error" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE);
session->state = STATE_REPLY;
return;
}
@@ -459,7 +459,7 @@ controller_read_socket (f_str_t *in, void *arg)
session->learn_filename, tokens, session->in_class);
session->worker->srv->stat->messages_learned ++;
i = snprintf (out_buf, sizeof (out_buf), "learn ok" CRLF);
- rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE);
+ rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE);
/* Clean learned parts */
while ((cur = g_list_first (session->parts))) {
@@ -541,7 +541,7 @@ accept_socket (int fd, short what, void *arg)
new_session->dispatcher = rspamd_create_dispatcher (nfd, BUFFER_LINE, controller_read_socket,
controller_write_socket, controller_err_socket, &io_tv,
(void *)new_session);
- rspamd_dispatcher_write (new_session->dispatcher, greetingbuf, strlen (greetingbuf), FALSE);
+ rspamd_dispatcher_write (new_session->dispatcher, greetingbuf, strlen (greetingbuf), FALSE, FALSE);
}
void
diff --git a/src/lmtp.c b/src/lmtp.c
index 431083657..d1928cf5c 100644
--- a/src/lmtp.c
+++ b/src/lmtp.c
@@ -246,7 +246,7 @@ accept_socket (int fd, short what, void *arg)
new_task->dispatcher = rspamd_create_dispatcher (nfd, BUFFER_LINE, lmtp_read_socket,
lmtp_write_socket, lmtp_err_socket, &io_tv,
(void *)lmtp);
- rspamd_dispatcher_write (lmtp->task->dispatcher, greetingbuf, strlen (greetingbuf), FALSE);
+ rspamd_dispatcher_write (lmtp->task->dispatcher, greetingbuf, strlen (greetingbuf), FALSE, FALSE);
}
/*
diff --git a/src/lmtp_proto.c b/src/lmtp_proto.c
index e6e09a825..69f343aaf 100644
--- a/src/lmtp_proto.c
+++ b/src/lmtp_proto.c
@@ -96,7 +96,7 @@ out_lmtp_reply (struct worker_task *task, int code, char *rcode, char *msg)
else {
r = snprintf (outbuf, OUTBUFSIZ, "%d %s %s\r\n", code, rcode, msg);
}
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
}
int
@@ -337,7 +337,7 @@ mta_read_socket (f_str_t *in, void *arg)
else {
r = snprintf (outbuf, sizeof (outbuf), "HELO %s" CRLF, hostbuf);
}
- rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE);
cd->state = LMTP_WANT_MAIL;
break;
case LMTP_WANT_MAIL:
@@ -347,7 +347,7 @@ mta_read_socket (f_str_t *in, void *arg)
return;
}
r = snprintf (outbuf, sizeof (outbuf), "MAIL FROM: <%s>" CRLF, cd->task->from);
- rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE);
cd->state = LMTP_WANT_RCPT;
break;
case LMTP_WANT_RCPT:
@@ -363,7 +363,7 @@ mta_read_socket (f_str_t *in, void *arg)
cur = g_list_next (cur);
}
- rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE);
cd->state = LMTP_WANT_DATA;
break;
case LMTP_WANT_DATA:
@@ -373,7 +373,7 @@ mta_read_socket (f_str_t *in, void *arg)
return;
}
r = snprintf (outbuf, sizeof (outbuf), "DATA" CRLF);
- rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE);
cd->state = LMTP_WANT_DOT;
break;
case LMTP_WANT_DOT:
@@ -384,10 +384,10 @@ mta_read_socket (f_str_t *in, void *arg)
}
c = g_mime_object_to_string ((GMimeObject *)cd->task->message);
r = strlen (c);
- rspamd_dispatcher_write (cd->task->dispatcher, c, r, TRUE);
- g_free (c);
+ rspamd_dispatcher_write (cd->task->dispatcher, c, r, TRUE, TRUE);
+ memory_pool_add_destructor (cd->task->task_pool, (pool_destruct_func)g_free, c);
r = snprintf (outbuf, sizeof (outbuf), CRLF "." CRLF);
- rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE);
cd->state = LMTP_WANT_CLOSING;
case LMTP_WANT_CLOSING:
if (!parse_mta_str (in, cd)) {
diff --git a/src/plugins/emails.c b/src/plugins/emails.c
index 67a641ab5..0b7e35d84 100644
--- a/src/plugins/emails.c
+++ b/src/plugins/emails.c
@@ -192,7 +192,7 @@ emails_command_handler (struct worker_task *task)
outbuf[r++] = '\r'; outbuf[r++] = '\n';
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
msg_info ("process_message: msg ok, id: <%s>, %d emails extracted", task->message_id, num);
return 0;
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 093b67d88..a7ff5bb7a 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -780,8 +780,8 @@ static int
urls_command_handler (struct worker_task *task)
{
GList *cur;
- char outbuf[16384], *urlstr;
- int r, num = 0;
+ char *outbuf, *urlstr;
+ int r, num = 0, buflen;
struct uri *url;
GError *err = NULL;
GTree *url_tree;
@@ -790,9 +790,22 @@ urls_command_handler (struct worker_task *task)
url_tree = g_tree_new ((GCompareFunc)g_ascii_strcasecmp);
- r = snprintf (outbuf, sizeof (outbuf), "%s 0 %s" CRLF, (task->proto == SPAMC_PROTO) ? SPAMD_REPLY_BANNER : RSPAMD_REPLY_BANNER, "OK");
+ /* First calculate buffer length */
+ cur = g_list_first (task->urls);
+ buflen = 0;
+ while (cur) {
+ url = cur->data;
+ buflen += strlen (struri (url)) + url->hostlen + sizeof (" <\"\">, ") - 1;
+ cur = g_list_next (cur);
+ }
+
+ buflen += sizeof (RSPAMD_REPLY_BANNER " 0 OK" CRLF CRLF);
+
+ outbuf = memory_pool_alloc (task->task_pool, buflen * sizeof (char));
+
+ r = snprintf (outbuf, buflen, "%s 0 %s" CRLF, (task->proto == SPAMC_PROTO) ? SPAMD_REPLY_BANNER : RSPAMD_REPLY_BANNER, "OK");
- r += snprintf (outbuf + r, sizeof (outbuf) - r - 2, "URLs: ");
+ r += snprintf (outbuf + r, buflen - r - 2, "URLs: ");
cur = g_list_first (task->urls);
@@ -805,10 +818,10 @@ urls_command_handler (struct worker_task *task)
f.len = url->hostlen;
if ((urlstr = format_surbl_request (task->task_pool, &f, NULL, &host_end, FALSE, &err)) != NULL) {
if (g_list_next (cur) != NULL) {
- r += snprintf (outbuf + r, sizeof (outbuf) - r - 2, "%s, ", (char *)urlstr);
+ r += snprintf (outbuf + r, buflen - r - 2, "%s <\"%s\">, ", (char *)urlstr, struri (url));
}
else {
- r += snprintf (outbuf + r, sizeof (outbuf) - r - 2, "%s", (char *)urlstr);
+ r += snprintf (outbuf + r, buflen - r - 2, "%s <\"%s\">", (char *)urlstr, struri (url));
}
}
}
@@ -817,7 +830,7 @@ urls_command_handler (struct worker_task *task)
outbuf[r++] = '\r'; outbuf[r++] = '\n';
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, TRUE);
msg_info ("process_message: msg ok, id: <%s>, %d urls extracted", task->message_id, num);
g_tree_destroy (url_tree);
diff --git a/src/protocol.c b/src/protocol.c
index 43a721765..5374487df 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -396,7 +396,7 @@ show_url_header (struct worker_task *task)
/* Do header folding */
if (host.len + r >= OUTBUFSIZ - 3) {
outbuf[r ++] = '\r'; outbuf[r ++] = '\n'; outbuf[r] = ' ';
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, TRUE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, TRUE, FALSE);
r = 0;
}
/* Write url host to buf */
@@ -416,7 +416,7 @@ show_url_header (struct worker_task *task)
}
cur = g_list_next (cur);
}
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
}
static void
@@ -451,7 +451,7 @@ metric_symbols_callback (gpointer key, gpointer value, void *user_data)
cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset,
"%s,", (char *)key);
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
}
static void
@@ -474,7 +474,7 @@ show_metric_symbols (struct metric_result *metric_res, struct metric_callback_da
cur = g_list_next (cur);
}
g_list_free (symbols);
- rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE);
}
else {
g_hash_table_foreach (metric_res->symbols, metric_symbols_callback, cd);
@@ -534,7 +534,7 @@ show_metric_result (gpointer metric_name, gpointer metric_value, void *user_data
#endif
}
else {
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
if (task->cmd == CMD_SYMBOLS && metric_value != NULL) {
show_metric_symbols (metric_res, cd);
@@ -553,7 +553,7 @@ write_check_reply (struct worker_task *task)
struct metric_callback_data cd;
r = snprintf (outbuf, sizeof (outbuf), "%s 0 %s" CRLF, (task->proto == SPAMC_PROTO) ? SPAMD_REPLY_BANNER : RSPAMD_REPLY_BANNER, "OK");
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, TRUE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, TRUE, FALSE);
cd.task = task;
cd.log_buf = logbuf;
@@ -589,7 +589,7 @@ write_check_reply (struct worker_task *task)
show_url_header (task);
}
msg_info ("%s", logbuf);
- rspamd_dispatcher_write (task->dispatcher, CRLF, sizeof (CRLF) - 1, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, CRLF, sizeof (CRLF) - 1, FALSE, TRUE);
return 0;
}
@@ -642,10 +642,10 @@ write_process_reply (struct worker_task *task)
outmsg = g_mime_object_to_string (GMIME_OBJECT (task->message));
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, TRUE);
- rspamd_dispatcher_write (task->dispatcher, outmsg, strlen (outmsg), FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, TRUE, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outmsg, strlen (outmsg), FALSE, TRUE);
- g_free (outmsg);
+ memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_free, outmsg);
return 0;
}
@@ -669,7 +669,7 @@ write_reply (struct worker_task *task)
msg_debug ("write_reply: writing error: %s", outbuf);
}
/* Write to bufferevent error message */
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
}
else {
switch (task->cmd) {
@@ -685,11 +685,11 @@ write_reply (struct worker_task *task)
case CMD_SKIP:
r = snprintf (outbuf, sizeof (outbuf), "%s 0 %s" CRLF, (task->proto == SPAMC_PROTO) ? SPAMD_REPLY_BANNER : RSPAMD_REPLY_BANNER,
SPAMD_OK);
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
break;
case CMD_PING:
r = snprintf (outbuf, sizeof (outbuf), "%s 0 PONG" CRLF, (task->proto == SPAMC_PROTO) ? SPAMD_REPLY_BANNER : RSPAMD_REPLY_BANNER);
- rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE);
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
break;
case CMD_OTHER:
return task->custom_cmd->func (task);
diff --git a/src/url.h b/src/url.h
index 7860f544a..c5ff46990 100644
--- a/src/url.h
+++ b/src/url.h
@@ -43,9 +43,6 @@ struct uri {
/* Flags */
unsigned int ipv6; /* URI contains IPv6 host */
unsigned int form; /* URI originated from form */
-
- /* Link */
- TAILQ_ENTRY(uri) next;
};
enum uri_errno {