diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-14 22:21:32 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-14 22:21:32 +0300 |
commit | 7762278bd16a304715b086f5709e8671c4f5a9ec (patch) | |
tree | c1ffa974454e15ad2ffa868230f68d72e5ad93d9 | |
parent | 726b9c4731948a5e995f197ee3bfacd210c01804 (diff) | |
download | libmicrohttpd-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-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/microhttpd/mhd_send.c | 4 |
2 files changed, 8 insertions, 0 deletions
@@ -1,3 +1,7 @@ | |||
1 | Web 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 | |||
1 | Sun 11 Apr 2021 15:44:00 MSK | 5 | Sun 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; |