gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35895 - libmicrohttpd/src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r35895 - libmicrohttpd/src/microhttpd
Date: Tue, 9 Jun 2015 00:18:30 +0200

Author: Karlson2k
Date: 2015-06-09 00:18:30 +0200 (Tue, 09 Jun 2015)
New Revision: 35895

Modified:
   libmicrohttpd/src/microhttpd/daemon.c
Log:
fix: send_param_adapter(): do not send chunks larger than requested when using 
sendfile()

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2015-06-08 22:06:01 UTC (rev 
35894)
+++ libmicrohttpd/src/microhttpd/daemon.c       2015-06-08 22:18:30 UTC (rev 
35895)
@@ -1107,15 +1107,15 @@
       /* can use sendfile */
       offset = (off_t) connection->response_write_position + 
connection->response->fd_off;
       left = connection->response->total_size - 
connection->response_write_position;
-      if (left > SSIZE_MAX)
-       left = SSIZE_MAX; /* cap at return value limit */
-      if (-1 != (ret = sendfile (connection->socket_fd,
+      if (i > left)
+        i = left;
+      if (0 < (ret = sendfile (connection->socket_fd,
                                 fd,
                                 &offset,
-                                (size_t) left)))
+                                i)))
        {
 #if EPOLL_SUPPORT
-         if (ret < left)
+          if (requested_size > (size_t) ret)
            {
              /* partial write --- no longer write-ready */
              connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;




reply via email to

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