From: Vsevolod Stakhov Date: Thu, 6 Jun 2013 16:12:35 +0000 (+0100) Subject: Stream read fix. X-Git-Tag: 0.5.6~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d68feb78b3ea56d2ea4103b9ef9b8770053981c;p=thirdparty%2Frspamd.git Stream read fix. --- diff --git a/src/worker.c b/src/worker.c index d37e3f9a24..828d2b4ccf 100644 --- a/src/worker.c +++ b/src/worker.c @@ -299,15 +299,23 @@ read_socket (f_str_t * in, void *arg) break; case READ_MESSAGE: /* Allow half-closed connections to be proceed */ - task->dispatcher->want_read = FALSE; + if (task->content_length > 0) { task->msg->begin = in->begin; task->msg->len = in->len; debug_task ("got string of length %z", task->msg->len); task->state = WAIT_FILTER; - + task->dispatcher->want_read = FALSE; } else { + if (!task->dispatcher->want_read && in->len == 0) { + /* + * Skip initial zero length string remain from + * buffer policy switch + */ + task->dispatcher->want_read = FALSE; + return TRUE; + } if (in->len > 0) { if (task->msg->begin == NULL) { /* Allocate buf */