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.
This commit is contained in:
Evgeny Grin (Karlson2k)
2021-04-14 22:21:32 +03:00
parent 726b9c4731
commit 7762278bd1
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -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.
+4
View File
@@ -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;