diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-14 09:55:41 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-14 09:55:41 +0100 |
commit | 5a5e892a64a1d23964010620c529d0947d692237 (patch) | |
tree | c933ac9644801f517c85c88fa813309795a5686a | |
parent | 6be8ca5a8fd7ef5e4993ca8ca65e1f6a44c28c45 (diff) | |
download | rspamd-5a5e892a64a1d23964010620c529d0947d692237.tar.gz rspamd-5a5e892a64a1d23964010620c529d0947d692237.zip |
[Fix] Fix sending of large entries via HTTPS
-rw-r--r-- | src/libutil/http_connection.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libutil/http_connection.c b/src/libutil/http_connection.c index 094438ee6..31e8a3c1e 100644 --- a/src/libutil/http_connection.c +++ b/src/libutil/http_connection.c @@ -774,7 +774,13 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn) niov = priv->outlen; remain = priv->wr_pos; /* We know that niov is small enough for that */ - cur_iov = alloca (niov * sizeof (struct iovec)); + if (priv->ssl) { + /* Might be recursive! */ + cur_iov = g_malloc (niov * sizeof (struct iovec)); + } + else { + cur_iov = alloca (niov * sizeof (struct iovec)); + } memcpy (cur_iov, priv->out, niov * sizeof (struct iovec)); for (i = 0; i < priv->outlen && remain > 0; i++) { /* Find out the first iov required */ @@ -801,6 +807,7 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn) if (priv->ssl) { r = rspamd_ssl_writev (priv->ssl, msg.msg_iov, msg.msg_iovlen); + g_free (cur_iov); } else { r = sendmsg (conn->fd, &msg, flags); @@ -827,6 +834,12 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn) else { /* Want to write more */ priv->flags &= ~RSPAMD_HTTP_CONN_FLAG_RESETED; + + if (priv->ssl && r > 0) { + /* We can write more data... */ + rspamd_http_write_helper (conn); + return; + } } return; |