gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: mhd_send: do not push incomplete


From: gnunet
Subject: [libmicrohttpd] branch master updated: mhd_send: do not push incomplete responses with vector send
Date: Thu, 15 Apr 2021 11:45:22 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new ddf368bb mhd_send: do not push incomplete responses with vector send
ddf368bb is described below

commit ddf368bb6d1093657ab29cb5af894bdc2b93788f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Apr 15 12:43:01 2021 +0300

    mhd_send: do not push incomplete responses with vector send
---
 src/microhttpd/mhd_send.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index f691cc7d..c237d469 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -1288,18 +1288,20 @@ send_iov_nontls (struct MHD_Connection *connection,
     return MHD_ERR_NOTCONN_;
   }
 
-  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;
+    push_data = false; /* Incomplete response */
+  }
 #endif /* IOV_MAX */
 #ifdef HAVE_SENDMSG
   memset (&msg, 0, sizeof(struct msghdr));
   msg.msg_iov = r_iov->iov + r_iov->sent;
   msg.msg_iovlen = items_to_send;
 
+  pre_send_setopt (connection, true, push_data);
 #ifdef MHD_USE_MSG_MORE
   res = sendmsg (connection->socket_fd, &msg,
                  MSG_NOSIGNAL_OR_ZERO | (push_data ? 0 : MSG_MORE));
@@ -1307,14 +1309,22 @@ send_iov_nontls (struct MHD_Connection *connection,
   res = sendmsg (connection->socket_fd, &msg, MSG_NOSIGNAL_OR_ZERO);
 #endif /* ! MHD_USE_MSG_MORE */
 #elif defined(HAVE_WRITEV)
+  pre_send_setopt (connection, true, push_data);
   res = writev (connection->socket_fd, r_iov->iov + r_iov->sent,
                 items_to_send);
 #elif defined(MHD_WINSOCK_SOCKETS)
 #ifdef _WIN64
-  cnt_w = (items_to_send > UINT32_MAX) ? UINT32_MAX : (DWORD) items_to_send;
+  if (items_to_send > UINT32_MAX)
+  {
+    cnt_w = UINT32_MAX;
+    push_data = false; /* Incomplete response */
+  }
+  else
+    cnt_w = (DWORD) items_to_send;
 #else  /* ! _WIN64 */
   cnt_w = (DWORD) items_to_send;
 #endif /* ! _WIN64 */
+  pre_send_setopt (connection, true, push_data);
   if (0 == WSASend (connection->socket_fd,
                     (LPWSABUF) (r_iov->iov + r_iov->sent),
                     cnt_w,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]