commit 7762278bd16a304715b086f5709e8671c4f5a9ec
parent 726b9c4731948a5e995f197ee3bfacd210c01804
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Wed, 14 Apr 2021 22:21:32 +0300
mhd_send: use sendmsg() in POSIX-compatible way
Some OSes may have limit on number of maximum elements per single
call of sendmsg()/writev(). Do not try to send more elements than
allowed by OS.
Diffstat:
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Web 14 Apr 2021 22:20:00 MSK
+ Fixed: use sendmsg() in POSIX-compatible way, do not try to send more
+ than IOV_MAX elements per single call. -EG
+
Sun 11 Apr 2021 15:44:00 MSK
Updated test TLS certificates to not expired modern versions, restored
HTTPS examples compatibility with modern browsers.
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
@@ -1291,6 +1291,10 @@ send_iov_nontls (struct MHD_Connection *connection,
pre_send_setopt (connection, true, push_data);
items_to_send = r_iov->cnt - r_iov->sent;
+#ifdef IOV_MAX
+ if (IOV_MAX < items_to_send)
+ items_to_send = IOV_MAX;
+#endif /* IOV_MAX */
#ifdef HAVE_SENDMSG
memset (&msg, 0, sizeof(struct msghdr));
msg.msg_iov = r_iov->iov + r_iov->sent;