aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-04-14 22:21:32 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-04-14 22:21:32 +0300
commit7762278bd16a304715b086f5709e8671c4f5a9ec (patch)
treec1ffa974454e15ad2ffa868230f68d72e5ad93d9
parent726b9c4731948a5e995f197ee3bfacd210c01804 (diff)
downloadlibmicrohttpd-7762278bd16a304715b086f5709e8671c4f5a9ec.tar.gz
libmicrohttpd-7762278bd16a304715b086f5709e8671c4f5a9ec.zip
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.
-rw-r--r--ChangeLog4
-rw-r--r--src/microhttpd/mhd_send.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 383eed63..a9318e91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Web 14 Apr 2021 22:20:00 MSK
2 Fixed: use sendmsg() in POSIX-compatible way, do not try to send more
3 than IOV_MAX elements per single call. -EG
4
1Sun 11 Apr 2021 15:44:00 MSK 5Sun 11 Apr 2021 15:44:00 MSK
2 Updated test TLS certificates to not expired modern versions, restored 6 Updated test TLS certificates to not expired modern versions, restored
3 HTTPS examples compatibility with modern browsers. 7 HTTPS examples compatibility with modern browsers.
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index f3028293..f691cc7d 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -1291,6 +1291,10 @@ send_iov_nontls (struct MHD_Connection *connection,
1291 pre_send_setopt (connection, true, push_data); 1291 pre_send_setopt (connection, true, push_data);
1292 1292
1293 items_to_send = r_iov->cnt - r_iov->sent; 1293 items_to_send = r_iov->cnt - r_iov->sent;
1294#ifdef IOV_MAX
1295 if (IOV_MAX < items_to_send)
1296 items_to_send = IOV_MAX;
1297#endif /* IOV_MAX */
1294#ifdef HAVE_SENDMSG 1298#ifdef HAVE_SENDMSG
1295 memset (&msg, 0, sizeof(struct msghdr)); 1299 memset (&msg, 0, sizeof(struct msghdr));
1296 msg.msg_iov = r_iov->iov + r_iov->sent; 1300 msg.msg_iov = r_iov->iov + r_iov->sent;