Fix coredumps while closing log file.
Fix parsing of chunked HTTP replies.
rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "Last message repeated %ud times", rspamd_log->repeats);
rspamd_log->repeats = 0;
if (rspamd_log->saved_message) {
- file_log_function (NULL, rspamd_log->saved_function, rspamd_log->cfg->log_level, rspamd_log->saved_message, TRUE, NULL);
+ file_log_function (NULL, rspamd_log->saved_function, rspamd_log->cfg->log_level, rspamd_log->saved_message, TRUE, rspamd_log);
g_free (rspamd_log->saved_message);
g_free (rspamd_log->saved_function);
rspamd_log->saved_message = NULL;
/* Read first chunk data */
skip = read_chunk_header (buf, len, data);
p += skip;
+ len -= skip;
}
- len -= skip;
data->chunk_read += len;
if (data->chunk_read >= data->chunk) {
/* Read next chunk and feed callback with remaining buffer */
/* copy remaining buffer to start of buffer */
data->rlen = len - (remain - p);
memmove (p, remain, data->rlen);
+ data->chunk_read -= data->rlen;
}
-
- p = buf + (len - (data->chunk_read - data->chunk));
+ }
+ if (data->chunk_read >= data->chunk) {
+ p = p + (len - (data->chunk_read - data->chunk));
if (*p != '\r') {
if (*p == '0') {
return TRUE;
cbd->cbdata.state = 0;
cbd->cbdata.prev_data = *cbd->map->user_data;
cbd->cbdata.cur_data = NULL;
+ cbd->data->rlen = 0;
+ cbd->data->chunk = 0;
+ cbd->data->chunk_read = 0;
+ cbd->data->chunked = FALSE;
+ cbd->data->read_buf[0] = '\0';
event_add (&cbd->ev, &cbd->tv);
}
memcpy (*url_str, m.m_begin, m.m_len);
(*url_str)[m.m_len] = '\0';
}
-
+ if (start != NULL) {
+ *start = (gchar *)m.m_begin;
+ }
+ if (fin != NULL) {
+ *fin = (gchar *)m.m_begin + m.m_len;
+ }
}
else {
*url_str = NULL;
+ if (start != NULL) {
+ *start = (gchar *)pos;
+ }
+ if (fin != NULL) {
+ *fin = (gchar *)pos + strlen (m.prefix);
+ }
}
- if (start != NULL) {
- *start = (gchar *)m.m_begin;
- }
- if (fin != NULL) {
- *fin = (gchar *)m.m_begin + m.m_len;
- }
+
return TRUE;
}
}