gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (740deea3 -> 60cdf5f9)


From: gnunet
Subject: [libmicrohttpd] branch master updated (740deea3 -> 60cdf5f9)
Date: Wed, 27 Oct 2021 19:56:40 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 740deea3 W32 VS projects: use C17 if available
     new a1cc6eee src/microhttpd/Makefile: cosmetics
     new 54e679e5 connection.c: fixed harmless compiler warning
     new 86b478e3 internal.h: clarified doxy
     new 8a9bb841 Chunked responses: do not provide extra space for the 
response if size is known
     new 60cdf5f9 chunked responses: alway unlock response if closing the 
connection

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/Makefile.am  |  4 ++--
 src/microhttpd/connection.c | 12 +++++++++---
 src/microhttpd/internal.h   |  1 +
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 3e4c5ea1..405f4735 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -197,8 +197,6 @@ check_PROGRAMS += \
   test_postprocessor_amp
 endif
 
-TESTS = $(check_PROGRAMS)
-
 # Do not test trigger of select by shutdown of listen socket
 # on Cygwin as this ability is deliberately ignored on Cygwin
 # to improve compatibility with core OS.
@@ -216,6 +214,8 @@ endif
 endif
 endif
 
+TESTS = $(check_PROGRAMS)
+
 test_start_stop_SOURCES = \
   test_start_stop.c
 test_start_stop_LDADD = \
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index e5ca32d1..33d54234 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1135,7 +1135,7 @@ try_ready_chunked_body (struct MHD_Connection *connection,
                               _ ("Closing connection (out of memory)."));
       return MHD_NO;
     }
-    /* Limit the buffer size to the large usable size for chunks */
+    /* Limit the buffer size to the largest usable size for chunks */
     if ( (max_chunk + max_chunk_overhead) < size)
       size = max_chunk + max_chunk_overhead;
     connection->write_buffer = MHD_pool_reallocate (connection->pool,
@@ -1150,14 +1150,14 @@ try_ready_chunked_body (struct MHD_Connection 
*connection,
   if (MHD_SIZE_UNKNOWN == response->total_size)
     left_to_send = MHD_SIZE_UNKNOWN;
   else
-    left_to_send = MHD_SIZE_UNKNOWN - connection->response_write_position;
+    left_to_send = response->total_size - connection->response_write_position;
 
   size_to_fill = connection->write_buffer_size - max_chunk_overhead;
   /* Limit size for the callback to the max usable size */
   if (max_chunk < size_to_fill)
     size_to_fill = max_chunk;
   if (left_to_send < size_to_fill)
-    size_to_fill = left_to_send;
+    size_to_fill = (size_t) left_to_send;
 
   if (0 == left_to_send)
     /* nothing to send, don't bother calling crc */
@@ -1183,6 +1183,9 @@ try_ready_chunked_body (struct MHD_Connection *connection,
   {
     if (NULL == response->crc)
     { /* There is no way to reach this code */
+#if defined(MHD_USE_THREADS)
+      MHD_mutex_unlock_chk_ (&response->mutex);
+#endif
       CONNECTION_CLOSE_ERROR (connection,
                               _ ("No callback for the chunked data."));
       return MHD_NO;
@@ -1222,6 +1225,9 @@ try_ready_chunked_body (struct MHD_Connection *connection,
   }
   if (size_to_fill < (size_t) ret)
   {
+#if defined(MHD_USE_THREADS)
+    MHD_mutex_unlock_chk_ (&response->mutex);
+#endif
     CONNECTION_CLOSE_ERROR (connection,
                             _ ("Closing connection (application returned " \
                                "more data than requested)."));
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 0a6ba032..28ec66e2 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -490,6 +490,7 @@ struct MHD_Response
 #endif
 
   /**
+   * The size of the response body.
    * Set to #MHD_SIZE_UNKNOWN if size is not known.
    */
   uint64_t total_size;

-- 
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]