gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31621 - libmicrohttpd/src/microhttpd
Date: Fri, 20 Dec 2013 17:04:06 +0100

Author: grothoff
Date: 2013-12-20 17:04:06 +0100 (Fri, 20 Dec 2013)
New Revision: 31621

Modified:
   libmicrohttpd/src/microhttpd/connection.c
Log:
-fix issue with sendfile incrementing buffer offset when it should not

Modified: libmicrohttpd/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd/src/microhttpd/connection.c   2013-12-20 15:26:03 UTC (rev 
31620)
+++ libmicrohttpd/src/microhttpd/connection.c   2013-12-20 16:04:06 UTC (rev 
31621)
@@ -1551,12 +1551,13 @@
 do_write (struct MHD_Connection *connection)
 {
   int ret;
+  size_t max;
 
+  max = connection->write_buffer_append_offset - 
connection->write_buffer_send_offset;
   ret = connection->send_cls (connection,
                               &connection->write_buffer
                               [connection->write_buffer_send_offset],
-                              connection->write_buffer_append_offset
-                              - connection->write_buffer_send_offset);
+                              max);
 
   if (ret < 0)
     {
@@ -1582,7 +1583,10 @@
            ret,
            &connection->write_buffer[connection->write_buffer_send_offset]);
 #endif
-  connection->write_buffer_send_offset += ret;
+  /* only increment if this wasn't a "sendfile" transmission without
+     buffer involvement! */
+  if (0 != max)
+    connection->write_buffer_send_offset += ret;
   return MHD_YES;
 }
 




reply via email to

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