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 */
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);
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;