Hello community,
here is the log from the commit of package libmicrohttpd for openSUSE:Factory checked in at 2019-07-22 12:14:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libmicrohttpd (Old)
and /work/SRC/openSUSE:Factory/.libmicrohttpd.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libmicrohttpd"
Mon Jul 22 12:14:41 2019 rev:34 rq:713706 version:0.9.65
Changes:
--------
--- /work/SRC/openSUSE:Factory/libmicrohttpd/libmicrohttpd.changes 2019-06-24 21:47:24.711829580 +0200
+++ /work/SRC/openSUSE:Factory/.libmicrohttpd.new.4126/libmicrohttpd.changes 2019-07-22 12:14:42.759755481 +0200
@@ -1,0 +2,13 @@
+Sat Jul 6 11:02:36 UTC 2019 - Martin Hauke
+
+- Update to versin 0.9.65:
+ * Many fixes and improvements for connection-specific memory pool
+ * Better handled connection's memory shortage situations:
+ + error response could be sent to client even if all buffer
+ space was used;
+ + if buffer space become low when receiving, do not allocate
+ last buffer space and use small receive blocks instead.
+ * Improved sending speed by using all available buffer space for
+ sending.
+
+-------------------------------------------------------------------
Old:
----
libmicrohttpd-0.9.64.tar.gz
libmicrohttpd-0.9.64.tar.gz.sig
New:
----
libmicrohttpd-0.9.65.tar.gz
libmicrohttpd-0.9.65.tar.gz.sig
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libmicrohttpd.spec ++++++
--- /var/tmp/diff_new_pack.Pw9lEB/_old 2019-07-22 12:14:43.363755317 +0200
+++ /var/tmp/diff_new_pack.Pw9lEB/_new 2019-07-22 12:14:43.363755317 +0200
@@ -20,7 +20,7 @@
%global sover 12
%global libname %{name}%{sover}
Name: libmicrohttpd
-Version: 0.9.64
+Version: 0.9.65
Release: 0
Summary: Small Embeddable HTTP Server Library
# Some internal tests are licenced as GPL-3.0+ - they are only used in
++++++ libmicrohttpd-0.9.64.tar.gz -> libmicrohttpd-0.9.65.tar.gz ++++++
++++ 2291 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/ChangeLog new/libmicrohttpd-0.9.65/ChangeLog
--- old/libmicrohttpd-0.9.64/ChangeLog 2019-06-09 19:32:14.000000000 +0200
+++ new/libmicrohttpd-0.9.65/ChangeLog 2019-07-05 22:21:24.000000000 +0200
@@ -1,3 +1,23 @@
+Fri Jul 05 2019 22:30:40 MSK
+ Releasing libmicrohttpd 0.9.65. -EG
+
+Sun Jun 23 2019 21:27:43 MSK
+ Many fixes and improvements for connection-specific memory pool:
+ * Added asserts;
+ * Added testing of reallocation;
+ * Reallocation code rewritten to avoid extra allocation, when
+ possible to reuse already allocated memory;
+ * Large memory pools aligned to system page size;
+ * Large memory pools on W32 are cleared more securely after use,
+ optimised usage of system memory.
+ Better handled connection's memory shortage situations:
+ * error response could be sent to client even if all buffer space
+ was used;
+ * if buffer space become low when receiving, do not allocate last
+ buffer space and use small receive blocks instead.
+ Improved sending speed by using all available buffer space for
+ sending. -EG
+
Sun Jun 09 2019 20:27:04 MSK
Releasing libmicrohttpd 0.9.64. -EG
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/MHD_config.h.in new/libmicrohttpd-0.9.65/MHD_config.h.in
--- old/libmicrohttpd-0.9.64/MHD_config.h.in 2019-06-09 19:33:24.000000000 +0200
+++ new/libmicrohttpd-0.9.65/MHD_config.h.in 2019-07-05 22:22:39.000000000 +0200
@@ -289,6 +289,9 @@
/* Define to 1 if `ss_len' is a member of `struct sockaddr_storage'. */
#undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN
+/* Define to 1 if you have the `sysconf' function. */
+#undef HAVE_SYSCONF
+
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_BYTEORDER_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/configure.ac new/libmicrohttpd-0.9.65/configure.ac
--- old/libmicrohttpd-0.9.64/configure.ac 2019-06-09 19:32:14.000000000 +0200
+++ new/libmicrohttpd-0.9.65/configure.ac 2019-07-05 22:21:24.000000000 +0200
@@ -22,15 +22,15 @@
#
AC_PREREQ([2.64])
LT_PREREQ([2.4.0])
-AC_INIT([GNU Libmicrohttpd],[0.9.64],[libmicrohttpd@gnu.org])
+AC_INIT([GNU Libmicrohttpd],[0.9.65],[libmicrohttpd@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([silent-rules] [subdir-objects])
AC_CONFIG_HEADERS([MHD_config.h])
AC_CONFIG_MACRO_DIR([m4])
-LIB_VERSION_CURRENT=63
+LIB_VERSION_CURRENT=64
LIB_VERSION_REVISION=0
-LIB_VERSION_AGE=51
+LIB_VERSION_AGE=52
AC_SUBST(LIB_VERSION_CURRENT)
AC_SUBST(LIB_VERSION_REVISION)
AC_SUBST(LIB_VERSION_AGE)
@@ -1202,6 +1202,8 @@
])
AC_MSG_RESULT($have_inet6)
+MHD_CHECK_FUNC([[sysconf]], [[#include ]], [[long a = sysconf(0); if (a) return 1;]])
+
HIDDEN_VISIBILITY_CFLAGS=""
AS_CASE(["$host"],
[*-*-mingw*],[
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/doc/doxygen/libmicrohttpd.doxy new/libmicrohttpd-0.9.65/doc/doxygen/libmicrohttpd.doxy
--- old/libmicrohttpd-0.9.64/doc/doxygen/libmicrohttpd.doxy 2019-06-09 19:33:17.000000000 +0200
+++ new/libmicrohttpd-0.9.65/doc/doxygen/libmicrohttpd.doxy 2019-07-05 22:22:30.000000000 +0200
@@ -38,7 +38,7 @@
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 0.9.64
+PROJECT_NUMBER = 0.9.65
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/doc/libmicrohttpd.info new/libmicrohttpd-0.9.65/doc/libmicrohttpd.info
--- old/libmicrohttpd-0.9.64/doc/libmicrohttpd.info 2019-06-09 19:33:27.000000000 +0200
+++ new/libmicrohttpd-0.9.65/doc/libmicrohttpd.info 2019-07-05 21:37:38.000000000 +0200
@@ -1,7 +1,7 @@
This is libmicrohttpd.info, produced by makeinfo version 6.6 from
libmicrohttpd.texi.
-This manual is for GNU libmicrohttpd (version 0.9.64, 9 June 2019), a
+This manual is for GNU libmicrohttpd (version 0.9.65, 30 June 2019), a
library for embedding an HTTP(S) server into C applications.
Copyright © 2007–2017 Christian Grothoff
@@ -23,7 +23,7 @@
The GNU libmicrohttpd Library
*****************************
-This manual is for GNU libmicrohttpd (version 0.9.64, 9 June 2019), a
+This manual is for GNU libmicrohttpd (version 0.9.65, 30 June 2019), a
library for embedding an HTTP(S) server into C applications.
Copyright © 2007–2017 Christian Grothoff
@@ -2703,8 +2703,8 @@
===================================================
-- Function: const union MHD_ConnectionInfo * MHD_get_connection_info
- (struct MHD_Connection *daemon, enum MHD_ConnectionInfoType
- infoType, ...)
+ (struct MHD_Connection *connection, enum
+ MHD_ConnectionInfoType infoType, ...)
Obtain information about the given connection.
CONNECTION
@@ -4622,43 +4622,43 @@
Tag Table:
-Node: Top813
-Node: microhttpd-intro3034
-Ref: fig:performance7951
-Ref: tbl:supported8922
-Node: microhttpd-const16899
-Node: microhttpd-struct51615
-Node: microhttpd-cb52399
-Node: microhttpd-init62597
-Node: microhttpd-inspect68448
-Node: microhttpd-requests71192
-Node: microhttpd-responses74860
-Node: microhttpd-response enqueue76059
-Ref: microhttpd-response enqueue-Footnote-178366
-Node: microhttpd-response create78601
-Node: microhttpd-response headers85271
-Node: microhttpd-response options87703
-Node: microhttpd-response inspect88574
-Node: microhttpd-response upgrade89795
-Node: microhttpd-flow94949
-Node: microhttpd-dauth98243
-Node: microhttpd-dauth basic99794
-Node: microhttpd-dauth digest101188
-Node: microhttpd-post111384
-Node: microhttpd-post api114383
-Node: microhttpd-info117027
-Node: microhttpd-info daemon117449
-Node: microhttpd-info conn120909
-Node: microhttpd-option conn125964
-Node: microhttpd-util127044
-Node: microhttpd-util feature127315
-Node: microhttpd-util unescape130901
-Node: GNU-LGPL131549
-Node: GNU GPL with eCos Extension159755
-Node: GNU-FDL179693
-Node: Concept Index204982
-Node: Function and Data Index214218
-Node: Type Index220741
+Node: Top814
+Node: microhttpd-intro3036
+Ref: fig:performance7953
+Ref: tbl:supported8924
+Node: microhttpd-const16901
+Node: microhttpd-struct51617
+Node: microhttpd-cb52401
+Node: microhttpd-init62599
+Node: microhttpd-inspect68450
+Node: microhttpd-requests71194
+Node: microhttpd-responses74862
+Node: microhttpd-response enqueue76061
+Ref: microhttpd-response enqueue-Footnote-178368
+Node: microhttpd-response create78603
+Node: microhttpd-response headers85273
+Node: microhttpd-response options87705
+Node: microhttpd-response inspect88576
+Node: microhttpd-response upgrade89797
+Node: microhttpd-flow94951
+Node: microhttpd-dauth98245
+Node: microhttpd-dauth basic99796
+Node: microhttpd-dauth digest101190
+Node: microhttpd-post111386
+Node: microhttpd-post api114385
+Node: microhttpd-info117029
+Node: microhttpd-info daemon117451
+Node: microhttpd-info conn120911
+Node: microhttpd-option conn125970
+Node: microhttpd-util127050
+Node: microhttpd-util feature127321
+Node: microhttpd-util unescape130907
+Node: GNU-LGPL131555
+Node: GNU GPL with eCos Extension159761
+Node: GNU-FDL179699
+Node: Concept Index204988
+Node: Function and Data Index214224
+Node: Type Index220747
End Tag Table
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/doc/libmicrohttpd.texi new/libmicrohttpd-0.9.65/doc/libmicrohttpd.texi
--- old/libmicrohttpd-0.9.64/doc/libmicrohttpd.texi 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/doc/libmicrohttpd.texi 2019-06-30 20:44:14.000000000 +0200
@@ -622,7 +622,7 @@
This option will only work if the underyling TLS library
supports it (i.e. GnuTLS after 3.6.3). If the TLS library
does not support it, MHD may ignore the option and proceed
-without supporting this features.
+without supporting this features.
@item MHD_USE_INSECURE_TLS_EARLY_DATA
Tell the TLS library to support TLS v1.3 early data (0-RTT) with the
@@ -633,7 +633,7 @@
This option will only work if the underyling TLS library
supports it (i.e. GnuTLS after 3.6.3). If the TLS library
does not support it, MHD may ignore the option and proceed
-without supporting this features.
+without supporting this features.
@end table
@end deftp
@@ -2956,7 +2956,7 @@
@section Obtaining state information about a connection
-@deftypefun {const union MHD_ConnectionInfo *} MHD_get_connection_info (struct MHD_Connection *daemon, enum MHD_ConnectionInfoType infoType, ...)
+@deftypefun {const union MHD_ConnectionInfo *} MHD_get_connection_info (struct MHD_Connection *connection, enum MHD_ConnectionInfoType infoType, ...)
Obtain information about the given connection.
@table @var
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/doc/stamp-vti new/libmicrohttpd-0.9.65/doc/stamp-vti
--- old/libmicrohttpd-0.9.64/doc/stamp-vti 2019-06-09 19:33:26.000000000 +0200
+++ new/libmicrohttpd-0.9.65/doc/stamp-vti 2019-07-05 22:22:41.000000000 +0200
@@ -1,4 +1,4 @@
-@set UPDATED 9 June 2019
+@set UPDATED 30 June 2019
@set UPDATED-MONTH June 2019
-@set EDITION 0.9.64
-@set VERSION 0.9.64
+@set EDITION 0.9.65
+@set VERSION 0.9.65
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/doc/version.texi new/libmicrohttpd-0.9.65/doc/version.texi
--- old/libmicrohttpd-0.9.64/doc/version.texi 2019-06-09 19:33:26.000000000 +0200
+++ new/libmicrohttpd-0.9.65/doc/version.texi 2019-07-05 21:37:36.000000000 +0200
@@ -1,4 +1,4 @@
-@set UPDATED 9 June 2019
+@set UPDATED 30 June 2019
@set UPDATED-MONTH June 2019
-@set EDITION 0.9.64
-@set VERSION 0.9.64
+@set EDITION 0.9.65
+@set VERSION 0.9.65
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/include/microhttpd.h new/libmicrohttpd-0.9.65/src/include/microhttpd.h
--- old/libmicrohttpd-0.9.64/src/include/microhttpd.h 2019-06-09 19:32:14.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/include/microhttpd.h 2019-07-05 22:21:24.000000000 +0200
@@ -132,7 +132,7 @@
* Current version of the library.
* 0x01093001 = 1.9.30-1.
*/
-#define MHD_VERSION 0x00096400
+#define MHD_VERSION 0x00096500
/**
* MHD-internal return code for "YES".
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/connection.c new/libmicrohttpd-0.9.65/src/microhttpd/connection.c
--- old/libmicrohttpd-0.9.64/src/microhttpd/connection.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/connection.c 2019-06-23 21:20:42.000000000 +0200
@@ -791,7 +791,7 @@
pos = MHD_pool_allocate (connection->pool,
sizeof (struct MHD_HTTP_Header),
- MHD_YES);
+ true);
if (NULL == pos)
return MHD_NO;
pos->header = (char *) key;
@@ -1342,9 +1342,7 @@
try_ready_chunked_body (struct MHD_Connection *connection)
{
ssize_t ret;
- char *buf;
struct MHD_Response *response;
- size_t size;
char cbuf[10]; /* 10: max strlen of "%x\r\n" */
int cblen;
@@ -1353,28 +1351,26 @@
return MHD_YES;
if (0 == connection->write_buffer_size)
{
- size = MHD_MIN (connection->daemon->pool_size,
- 2 * (0xFFFFFF + sizeof(cbuf) + 2));
- do
+ size_t size;
+
+ size = MHD_pool_get_free (connection->pool);
+ if (size < 128)
{
- size /= 2;
- if (size < 128)
- {
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
- MHD_mutex_unlock_chk_ (&response->mutex);
+ MHD_mutex_unlock_chk_ (&response->mutex);
#endif
- /* not enough memory */
- CONNECTION_CLOSE_ERROR (connection,
- _("Closing connection (out of memory)\n"));
- return MHD_NO;
- }
- buf = MHD_pool_allocate (connection->pool,
- size,
- MHD_NO);
+ /* not enough memory */
+ CONNECTION_CLOSE_ERROR (connection,
+ _("Closing connection (out of memory)\n"));
+ return MHD_NO;
}
- while (NULL == buf);
+ if ( (2 * (0xFFFFFF + sizeof(cbuf) + 2)) < size)
+ size = 2 * (0xFFFFFF + sizeof(cbuf) + 2);
+ connection->write_buffer = MHD_pool_allocate (connection->pool,
+ size,
+ false);
+ mhd_assert (NULL != connection->write_buffer);
connection->write_buffer_size = size;
- connection->write_buffer = buf;
}
if (0 == response->total_size)
@@ -1579,28 +1575,51 @@
* minimum necessary at that point.
*
* @param connection the connection
- * @return #MHD_YES on success, #MHD_NO on failure
+ * @param required set to 'true' if grow is required, i.e. connection
+ * will fail if no additional space is granted
+ * @return 'true' on success, 'false' on failure
*/
-static int
-try_grow_read_buffer (struct MHD_Connection *connection)
+static bool
+try_grow_read_buffer (struct MHD_Connection *connection,
+ bool required)
{
- void *buf;
size_t new_size;
+ size_t avail_size;
+ avail_size = MHD_pool_get_free (connection->pool);
+ if (0 == avail_size)
+ return false; /* No more space available */
if (0 == connection->read_buffer_size)
- new_size = connection->daemon->pool_size / 2;
+ new_size = avail_size / 2; /* Use half of available buffer for reading */
else
- new_size = connection->read_buffer_size + MHD_BUF_INC_SIZE;
- buf = MHD_pool_reallocate (connection->pool,
- connection->read_buffer,
- connection->read_buffer_size,
- new_size);
- if (NULL == buf)
- return MHD_NO;
+ {
+ size_t grow_size;
+
+ grow_size = avail_size / 8;
+ if (MHD_BUF_INC_SIZE > grow_size)
+ { /* Shortage of space */
+ if (!required)
+ return false; /* Grow is not mandatory, leave some space in pool */
+ else
+ {
+ /* Shortage of space, but grow is mandatory */
+ static const size_t small_inc = MHD_BUF_INC_SIZE / 8;
+ if (small_inc < avail_size)
+ grow_size = small_inc;
+ else
+ grow_size = avail_size;
+ }
+ }
+ new_size = connection->read_buffer_size + grow_size;
+ }
/* we can actually grow the buffer, do it! */
- connection->read_buffer = buf;
+ connection->read_buffer = MHD_pool_reallocate (connection->pool,
+ connection->read_buffer,
+ connection->read_buffer_size,
+ new_size);
+ mhd_assert (NULL != connection->read_buffer);
connection->read_buffer_size = new_size;
- return MHD_YES;
+ return true;
}
@@ -1644,7 +1663,7 @@
{
data = MHD_pool_allocate (connection->pool,
0,
- MHD_YES);
+ true);
connection->write_buffer = data;
connection->write_buffer_append_offset = 0;
connection->write_buffer_send_offset = 0;
@@ -1880,7 +1899,7 @@
/* produce data */
data = MHD_pool_allocate (connection->pool,
size + 1,
- MHD_NO);
+ false);
if (NULL == data)
{
#ifdef HAVE_MESSAGES
@@ -1995,6 +2014,16 @@
}
connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
connection->read_closed = true;
+ if (0 != connection->read_buffer_size)
+ {
+ /* Read buffer is not needed anymore, discard it
+ * to free some space for error response. */
+ connection->read_buffer = MHD_pool_reallocate(connection->pool,
+ connection->read_buffer,
+ connection->read_buffer_size,
+ 0);
+ connection->read_buffer_size = 0;
+ }
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
_("Error processing request (HTTP response code is %u (`%s')). Closing connection.\n"),
@@ -2091,7 +2120,7 @@
/* while reading headers, we always grow the
read buffer if needed, no size-check required */
if ( (connection->read_buffer_offset == connection->read_buffer_size) &&
- (MHD_NO == try_grow_read_buffer (connection)) )
+ (!try_grow_read_buffer (connection, true)) )
{
transmit_error_response (connection,
(connection->url != NULL)
@@ -2117,9 +2146,10 @@
case MHD_CONNECTION_CONTINUE_SENT:
if (connection->read_buffer_offset == connection->read_buffer_size)
{
- if ((MHD_YES != try_grow_read_buffer (connection)) &&
- (0 != (connection->daemon->options &
- MHD_USE_INTERNAL_POLLING_THREAD)))
+ const bool internal_poll = (0 != (connection->daemon->options &
+ MHD_USE_INTERNAL_POLLING_THREAD));
+ if ( (!try_grow_read_buffer (connection, true)) &&
+ internal_poll)
{
/* failed to grow the read buffer, and the
client which is supposed to handle the
@@ -2238,8 +2268,7 @@
{
/* not found, consider growing... */
if ( (connection->read_buffer_offset == connection->read_buffer_size) &&
- (MHD_NO ==
- try_grow_read_buffer (connection)) )
+ (!try_grow_read_buffer (connection, true)) )
{
transmit_error_response (connection,
(NULL != connection->url)
@@ -2338,7 +2367,7 @@
return MHD_YES;
cpy = MHD_pool_allocate (connection->pool,
hdr_len + 1,
- MHD_YES);
+ true);
if (NULL == cpy)
{
#ifdef HAVE_MESSAGES
@@ -2794,7 +2823,8 @@
connection->remaining_upload_size -= processed_size;
}
while (MHD_YES == instant_retry);
- if (available > 0)
+ if ( (available > 0) &&
+ (buffer_head != connection->read_buffer) )
memmove (connection->read_buffer,
buffer_head,
available);
@@ -3150,7 +3180,8 @@
in buffer to use per system call (if possible) */
if (connection->read_buffer_offset + connection->daemon->pool_increment >
connection->read_buffer_size)
- try_grow_read_buffer (connection);
+ try_grow_read_buffer (connection,
+ (connection->read_buffer_size == connection->read_buffer_offset));
if (connection->read_buffer_size == connection->read_buffer_offset)
return; /* No space for receiving data. */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/daemon.c new/libmicrohttpd-0.9.65/src/microhttpd/daemon.c
--- old/libmicrohttpd-0.9.64/src/microhttpd/daemon.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/daemon.c 2019-06-30 20:44:14.000000000 +0200
@@ -167,12 +167,12 @@
MHD_init(void);
-#if defined(_WIN32) && ! defined(__CYGWIN__)
+#if defined(MHD_WINSOCK_SOCKETS)
/**
* Track initialization of winsock
*/
static int mhd_winsock_inited_ = 0;
-#endif
+#endif /* MHD_WINSOCK_SOCKETS */
#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
/**
@@ -235,6 +235,21 @@
/**
+ * Free the memory given by @a ptr. Calls "free(ptr)". This function
+ * should be used to free the username returned by
+ * #MHD_digest_auth_get_username().
+ * @note Since v0.9.56
+ *
+ * @param ptr pointer to free.
+ */
+_MHD_EXTERN void
+MHD_free (void *ptr)
+{
+ free (ptr);
+}
+
+
+/**
* Trace up to and return master daemon. If the supplied daemon
* is a master, then return the daemon itself.
*
@@ -3800,7 +3815,7 @@
struct pollfd *p;
MHD_socket ls;
- p = MHD_calloc_ ((2 + num_connections),
+ p = MHD_calloc_ ((2 + (size_t)num_connections),
sizeof (struct pollfd));
if (NULL == p)
{
@@ -7132,20 +7147,20 @@
void
MHD_init(void)
{
-#if defined(_WIN32) && ! defined(__CYGWIN__)
+#if defined(MHD_WINSOCK_SOCKETS)
WSADATA wsd;
-#endif /* _WIN32 && ! __CYGWIN__ */
+#endif /* MHD_WINSOCK_SOCKETS */
if (NULL == mhd_panic)
mhd_panic = &mhd_panic_std;
-#if defined(_WIN32) && ! defined(__CYGWIN__)
+#if defined(MHD_WINSOCK_SOCKETS)
if (0 != WSAStartup(MAKEWORD(2, 2), &wsd))
MHD_PANIC (_("Failed to initialize winsock\n"));
mhd_winsock_inited_ = 1;
if (2 != LOBYTE(wsd.wVersion) && 2 != HIBYTE(wsd.wVersion))
MHD_PANIC (_("Winsock version 2.2 is not available\n"));
-#endif
+#endif /* MHD_WINSOCK_SOCKETS */
#ifdef HTTPS_SUPPORT
#ifdef MHD_HTTPS_REQUIRE_GRYPT
#if GCRYPT_VERSION_NUMBER < 0x010600
@@ -7170,6 +7185,7 @@
#ifdef HAVE_FREEBSD_SENDFILE
MHD_conn_init_static_ ();
#endif /* HAVE_FREEBSD_SENDFILE */
+ MHD_init_mem_pools_ ();
}
@@ -7179,10 +7195,10 @@
#ifdef HTTPS_SUPPORT
gnutls_global_deinit ();
#endif /* HTTPS_SUPPORT */
-#if defined(_WIN32) && ! defined(__CYGWIN__)
+#if defined(MHD_WINSOCK_SOCKETS)
if (mhd_winsock_inited_)
WSACleanup();
-#endif
+#endif /* MHD_WINSOCK_SOCKETS */
MHD_monotonic_sec_counter_finish();
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/internal.h new/libmicrohttpd-0.9.65/src/microhttpd/internal.h
--- old/libmicrohttpd-0.9.64/src/microhttpd/internal.h 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/internal.h 2019-06-23 21:20:42.000000000 +0200
@@ -93,7 +93,7 @@
/**
- * Minimum size by which MHD tries to increment read/write buffers.
+ * Minimum reasonable size by which MHD tries to increment read/write buffers.
* We usually begin with half the available pool space for the
* IO-buffer, but if absolutely needed we additively grow by the
* number of bytes given here (up to -- theoretically -- the full pool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/memorypool.c new/libmicrohttpd-0.9.65/src/microhttpd/memorypool.c
--- old/libmicrohttpd-0.9.64/src/microhttpd/memorypool.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/memorypool.c 2019-06-23 21:20:42.000000000 +0200
@@ -1,6 +1,7 @@
/*
This file is part of libmicrohttpd
- Copyright (C) 2007, 2009, 2010 Daniel Pittman and Christian Grothoff
+ Copyright (C) 2007--2019 Daniel Pittman, Christian Grothoff and
+ Karlson2k (Evgeny Grin)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,14 +22,35 @@
* @file memorypool.c
* @brief memory pool
* @author Christian Grothoff
+ * @author Karlson2k (Evgeny Grin)
*/
#include "memorypool.h"
+#include
+#include
+#include
+#include "mhd_assert.h"
+#if HAVE_SYS_MMAN_H
+#include
+#endif
+#ifdef _WIN32
+#include
+#endif
+#ifdef HAVE_SYSCONF
+#include
+#if defined(_SC_PAGE_SIZE)
+#define MHD_SC_PAGESIZE _SC_PAGE_SIZE
+#elif defined(_SC_PAGESIZE)
+#define MHD_SC_PAGESIZE _SC_PAGESIZE
+#endif /* _SC_PAGESIZE */
+#endif /* HAVE_SYSCONF */
/* define MAP_ANONYMOUS for Mac OS X */
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON
#endif
-#ifndef MAP_FAILED
+#if defined(_WIN32)
+#define MAP_FAILED NULL
+#elif !defined(MAP_FAILED)
#define MAP_FAILED ((void*)-1)
#endif
@@ -40,8 +62,42 @@
/**
* Round up 'n' to a multiple of ALIGN_SIZE.
*/
-#define ROUND_TO_ALIGN(n) ((n+(ALIGN_SIZE-1)) & (~(ALIGN_SIZE-1)))
+#define ROUND_TO_ALIGN(n) (((n)+(ALIGN_SIZE-1)) / (ALIGN_SIZE) * (ALIGN_SIZE))
+
+#if defined(PAGE_SIZE)
+#define MHD_DEF_PAGE_SIZE_ PAGE_SIZE
+#elif defined(PAGESIZE)
+#define MHD_DEF_PAGE_SIZE_ PAGE_SIZE
+#else /* ! PAGESIZE */
+#define MHD_DEF_PAGE_SIZE_ (4096)
+#endif /* ! PAGESIZE */
+
+/**
+ * Size of memory page
+ */
+static size_t MHD_sys_page_size_ = MHD_DEF_PAGE_SIZE_; /* Default fallback value */
+/**
+ * Initilise values for memory pools
+ */
+void
+MHD_init_mem_pools_ (void)
+{
+#ifdef MHD_SC_PAGESIZE
+ long result;
+ result = sysconf (MHD_SC_PAGESIZE);
+ if (-1 != result)
+ MHD_sys_page_size_ = (size_t) result;
+ else
+ MHD_sys_page_size_ = MHD_DEF_PAGE_SIZE_;
+#elif defined(_WIN32)
+ SYSTEM_INFO si;
+ GetSystemInfo (&si);
+ MHD_sys_page_size_ = (size_t)si.dwPageSize;
+#else
+ MHD_sys_page_size_ = MHD_DEF_PAGE_SIZE_;
+#endif /* _WIN32 */
+}
/**
* Handle for a memory pool. Pools are not reentrant and must not be
@@ -53,7 +109,7 @@
/**
* Pointer to the pool's memory
*/
- char *memory;
+ uint8_t *memory;
/**
* Size of the pool.
@@ -66,33 +122,18 @@
size_t pos;
/**
- * Offset of the last unallocated byte.
+ * Offset of the byte after the last unallocated byte.
*/
size_t end;
/**
- * #MHD_NO if pool was malloc'ed, #MHD_YES if mmapped (VirtualAlloc'ed for W32).
+ * 'false' if pool was malloc'ed, 'true' if mmapped (VirtualAlloc'ed for W32).
*/
- int is_mmap;
+ bool is_mmap;
};
/**
- * Free the memory given by @a ptr. Calls "free(ptr)". This function
- * should be used to free the username returned by
- * #MHD_digest_auth_get_username().
- * @note Since v0.9.56
- *
- * @param ptr pointer to free.
- */
-_MHD_EXTERN void
-MHD_free (void *ptr)
-{
- free (ptr);
-}
-
-
-/**
* Create a memory pool.
*
* @param max maximum size of the pool
@@ -102,48 +143,57 @@
MHD_pool_create (size_t max)
{
struct MemoryPool *pool;
+ size_t alloc_size;
pool = malloc (sizeof (struct MemoryPool));
if (NULL == pool)
return NULL;
#if defined(MAP_ANONYMOUS) || defined(_WIN32)
- if (max <= 32 * 1024)
+ if ( (max <= 32 * 1024) ||
+ (max < MHD_sys_page_size_ * 4 / 3) )
pool->memory = MAP_FAILED;
else
+ {
+ /* Round up allocation to page granularity. */
+ alloc_size = max + MHD_sys_page_size_ - 1;
+ alloc_size -= alloc_size % MHD_sys_page_size_;
#if defined(MAP_ANONYMOUS) && !defined(_WIN32)
- pool->memory = mmap (NULL,
- max,
- PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS,
- -1,
- 0);
+ pool->memory = mmap (NULL,
+ alloc_size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS,
+ -1,
+ 0);
#elif defined(_WIN32)
- pool->memory = VirtualAlloc (NULL,
- max,
- MEM_COMMIT | MEM_RESERVE,
- PAGE_READWRITE);
-#endif
-#else
+ pool->memory = VirtualAlloc (NULL,
+ alloc_size,
+ MEM_COMMIT | MEM_RESERVE,
+ PAGE_READWRITE);
+#endif /* _WIN32 */
+ }
+#else /* ! _WIN32 && ! MAP_ANONYMOUS */
pool->memory = MAP_FAILED;
-#endif
- if ( (MAP_FAILED == pool->memory) ||
- (NULL == pool->memory))
+#endif /* ! _WIN32 && ! MAP_ANONYMOUS */
+ if (MAP_FAILED == pool->memory)
{
- pool->memory = malloc (max);
+ alloc_size = ROUND_TO_ALIGN(max);
+ pool->memory = malloc (alloc_size);
if (NULL == pool->memory)
{
free (pool);
return NULL;
}
- pool->is_mmap = MHD_NO;
+ pool->is_mmap = false;
}
+#if defined(MAP_ANONYMOUS) || defined(_WIN32)
else
{
- pool->is_mmap = MHD_YES;
+ pool->is_mmap = true;
}
+#endif /* _WIN32 || MAP_ANONYMOUS */
pool->pos = 0;
- pool->end = max;
- pool->size = max;
+ pool->end = alloc_size;
+ pool->size = alloc_size;
return pool;
}
@@ -158,7 +208,10 @@
{
if (NULL == pool)
return;
- if (MHD_NO == pool->is_mmap)
+
+ mhd_assert (pool->end >= pool->pos);
+ mhd_assert (pool->size >= pool->end - pool->pos);
+ if (!pool->is_mmap)
free (pool->memory);
else
#if defined(MAP_ANONYMOUS) && !defined(_WIN32)
@@ -184,6 +237,8 @@
size_t
MHD_pool_get_free (struct MemoryPool *pool)
{
+ mhd_assert (pool->end >= pool->pos);
+ mhd_assert (pool->size >= pool->end - pool->pos);
return (pool->end - pool->pos);
}
@@ -193,7 +248,7 @@
*
* @param pool memory pool to use for the operation
* @param size number of bytes to allocate
- * @param from_end allocate from end of pool (set to #MHD_YES);
+ * @param from_end allocate from end of pool (set to 'true');
* use this for small, persistent allocations that
* will never be reallocated
* @return NULL if the pool cannot support size more
@@ -202,18 +257,20 @@
void *
MHD_pool_allocate (struct MemoryPool *pool,
size_t size,
- int from_end)
+ bool from_end)
{
void *ret;
size_t asize;
+ mhd_assert (pool->end >= pool->pos);
+ mhd_assert (pool->size >= pool->end - pool->pos);
asize = ROUND_TO_ALIGN (size);
if ( (0 == asize) && (0 != size) )
return NULL; /* size too close to SIZE_MAX */
if ( (pool->pos + asize > pool->end) ||
(pool->pos + asize < pool->pos))
return NULL;
- if (from_end == MHD_YES)
+ if (from_end)
{
ret = &pool->memory[pool->end - asize];
pool->end -= asize;
@@ -234,7 +291,7 @@
* If the given block is not the most recently
* (re)allocated block, the memory of the previous
* allocation may be leaked until the pool is
- * destroyed (and copying the data maybe required).
+ * destroyed or reset.
*
* @param pool memory pool to use for the operation
* @param old the existing block
@@ -250,50 +307,60 @@
size_t old_size,
size_t new_size)
{
- void *ret;
size_t asize;
+ uint8_t *new_blc;
- asize = ROUND_TO_ALIGN (new_size);
- if ( (0 == asize) &&
- (0 != new_size) )
- return NULL; /* new_size too close to SIZE_MAX */
- if ( (pool->end < old_size) ||
- (pool->end < asize) )
- return NULL; /* unsatisfiable or bogus request */
-
- if ( (pool->pos >= old_size) &&
- (&pool->memory[pool->pos - old_size] == old) )
- {
- /* was the previous allocation - optimize! */
- if (pool->pos + asize - old_size <= pool->end)
- {
- /* fits */
- pool->pos += asize - old_size;
- if (asize < old_size) /* shrinking - zero again! */
- memset (&pool->memory[pool->pos],
- 0,
- old_size - asize);
+ mhd_assert (pool->end >= pool->pos);
+ mhd_assert (pool->size >= pool->end - pool->pos);
+ mhd_assert (old != NULL || old_size == 0);
+ mhd_assert (old == NULL || pool->memory <= (uint8_t*)old);
+ mhd_assert (old == NULL || pool->memory + pool->size >= (uint8_t*)old + old_size);
+ /* Blocks "from the end" must not be reallocated */
+ mhd_assert (old == NULL || pool->memory + pool->pos > (uint8_t*)old);
+
+ if (0 != old_size)
+ { /* Need to save some data */
+ const size_t old_offset = (uint8_t*)old - pool->memory;
+ const bool shrinking = (old_size > new_size);
+ /* Try resizing in-place */
+ if (shrinking)
+ { /* Shrinking in-place, zero-out freed part */
+ memset ((uint8_t*)old + new_size, 0, old_size - new_size);
+ }
+ if (pool->pos == ROUND_TO_ALIGN (old_offset + old_size))
+ { /* "old" block is the last allocated block */
+ const size_t new_apos = ROUND_TO_ALIGN (old_offset + new_size);
+ if (!shrinking)
+ { /* Grow in-place, check for enough space. */
+ if ( (new_apos > pool->end) ||
+ (new_apos < pool->pos) ) /* Value wrap */
+ return NULL; /* No space */
+ }
+ /* Resized in-place */
+ pool->pos = new_apos;
return old;
}
- /* does not fit */
- return NULL;
+ if (shrinking)
+ return old; /* Resized in-place, freed part remains allocated */
}
- if (asize <= old_size)
- return old; /* cannot shrink, no need to move */
- if ((pool->pos + asize >= pool->pos) &&
- (pool->pos + asize <= pool->end))
+ /* Need to allocate new block */
+ asize = ROUND_TO_ALIGN (new_size);
+ if ( ( (0 == asize) &&
+ (0 != new_size) ) || /* Value wrap, too large new_size. */
+ (asize > pool->end - pool->pos) ) /* Not enough space */
+ return NULL;
+
+ new_blc = pool->memory + pool->pos;
+ pool->pos += asize;
+
+ if (0 != old_size)
{
- /* fits */
- ret = &pool->memory[pool->pos];
- if (0 != old_size)
- memmove (ret,
- old,
- old_size);
- pool->pos += asize;
- return ret;
+ /* Move data to new block, old block remains allocated */
+ memcpy (new_blc, old, old_size);
+ /* Zero-out old block */
+ memset (old, 0, old_size);
}
- /* does not fit */
- return NULL;
+ return new_blc;
}
@@ -316,6 +383,12 @@
size_t copy_bytes,
size_t new_size)
{
+ mhd_assert (pool->end >= pool->pos);
+ mhd_assert (pool->size >= pool->end - pool->pos);
+ mhd_assert (copy_bytes < new_size);
+ mhd_assert (keep != NULL || copy_bytes == 0);
+ mhd_assert (keep == NULL || pool->memory <= (uint8_t*)keep);
+ mhd_assert (keep == NULL || pool->memory + pool->size >= (uint8_t*)keep + copy_bytes);
if ( (NULL != keep) &&
(keep != pool->memory) )
{
@@ -323,17 +396,45 @@
memmove (pool->memory,
keep,
copy_bytes);
- keep = pool->memory;
}
- pool->end = pool->size;
/* technically not needed, but safer to zero out */
if (pool->size > copy_bytes)
- memset (&pool->memory[copy_bytes],
- 0,
- pool->size - copy_bytes);
- if (NULL != keep)
- pool->pos = ROUND_TO_ALIGN (new_size);
- return keep;
+ {
+ size_t to_zero; /** Size of area to zero-out */
+
+ to_zero = pool->size - copy_bytes;
+#ifdef _WIN32
+ if (pool->is_mmap)
+ {
+ size_t to_recommit; /** Size of decommitted and re-committed area. */
+ uint8_t *recommit_addr;
+ /* Round down to page size */
+ to_recommit = to_zero - to_zero % MHD_sys_page_size_;
+ recommit_addr = pool->memory + pool->size - to_recommit;
+
+ /* De-committing and re-committing again clear memory and make
+ * pages free / available for other needs until accessed. */
+ if (VirtualFree (recommit_addr,
+ to_recommit,
+ MEM_DECOMMIT))
+ {
+ to_zero -= to_recommit;
+
+ if (recommit_addr != VirtualAlloc (recommit_addr,
+ to_recommit,
+ MEM_COMMIT,
+ PAGE_READWRITE))
+ abort(); /* Serious error, must never happen */
+ }
+ }
+#endif /* _WIN32 */
+ memset (&pool->memory[copy_bytes],
+ 0,
+ to_zero);
+ }
+ pool->pos = ROUND_TO_ALIGN (new_size);
+ pool->end = pool->size;
+ return pool->memory;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/memorypool.h new/libmicrohttpd-0.9.65/src/microhttpd/memorypool.h
--- old/libmicrohttpd-0.9.64/src/microhttpd/memorypool.h 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/memorypool.h 2019-06-23 21:20:42.000000000 +0200
@@ -1,6 +1,7 @@
/*
This file is part of libmicrohttpd
- Copyright (C) 2007, 2009 Daniel Pittman and Christian Grothoff
+ Copyright (C) 2007--2019 Daniel Pittman, Christian Grothoff and
+ Karlson2k (Evgeny Grin)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,12 +24,17 @@
* for each connection and bounding memory use for each
* request
* @author Christian Grothoff
+ * @author Karlson2k (Evgeny Grin)
*/
#ifndef MEMORYPOOL_H
#define MEMORYPOOL_H
-#include "internal.h"
+#include "mhd_options.h"
+#include
+#ifdef HAVE_STDBOOL_H
+#include
+#endif
/**
* Opaque handle for a memory pool.
@@ -37,6 +43,12 @@
*/
struct MemoryPool;
+/**
+ * Initilise values for memory pools
+ */
+void
+MHD_init_mem_pools_ (void);
+
/**
* Create a memory pool.
@@ -62,7 +74,7 @@
*
* @param pool memory pool to use for the operation
* @param size number of bytes to allocate
- * @param from_end allocate from end of pool (set to #MHD_YES);
+ * @param from_end allocate from end of pool (set to 'true');
* use this for small, persistent allocations that
* will never be reallocated
* @return NULL if the pool cannot support size more
@@ -70,8 +82,8 @@
*/
void *
MHD_pool_allocate (struct MemoryPool *pool,
- size_t size,
- int from_end);
+ size_t size,
+ bool from_end);
/**
@@ -81,15 +93,15 @@
* If the given block is not the most recently
* (re)allocated block, the memory of the previous
* allocation may be leaked until the pool is
- * destroyed (and copying the data maybe required).
+ * destroyed or reset.
*
* @param pool memory pool to use for the operation
* @param old the existing block
* @param old_size the size of the existing block
* @param new_size the new size of the block
* @return new address of the block, or
- * NULL if the pool cannot support new_size
- * bytes (old continues to be valid for old_size)
+ * NULL if the pool cannot support @a new_size
+ * bytes (old continues to be valid for @a old_size)
*/
void *
MHD_pool_reallocate (struct MemoryPool *pool,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/mhd_sockets.h new/libmicrohttpd-0.9.65/src/microhttpd/mhd_sockets.h
--- old/libmicrohttpd-0.9.64/src/microhttpd/mhd_sockets.h 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/mhd_sockets.h 2019-06-23 21:20:42.000000000 +0200
@@ -276,7 +276,7 @@
* @return ssize_t type value
*/
#define MHD_send_(s,b,l) \
- ((ssize_t)send((s),(const void*)(b),((MHD_SCKT_SEND_SIZE_)l), MAYBE_MSG_NOSIGNAL))
+ ((ssize_t)send((s),(const void*)(b),(MHD_SCKT_SEND_SIZE_)(l), MAYBE_MSG_NOSIGNAL))
/**
@@ -287,7 +287,7 @@
* @return ssize_t type value
*/
#define MHD_recv_(s,b,l) \
- ((ssize_t)recv((s),(void*)(b),((MHD_SCKT_SEND_SIZE_)l), 0))
+ ((ssize_t)recv((s),(void*)(b),(MHD_SCKT_SEND_SIZE_)(l), 0))
/**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/postprocessor.c new/libmicrohttpd-0.9.65/src/microhttpd/postprocessor.c
--- old/libmicrohttpd-0.9.64/src/microhttpd/postprocessor.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/postprocessor.c 2019-06-30 20:44:14.000000000 +0200
@@ -520,12 +520,14 @@
* rest of the line into the suffix ptr.
*
* @param prefix prefix to match
+ * @param prefix_len length of @a prefix
* @param line line to match prefix in
* @param suffix set to a copy of the rest of the line, starting at the end of the match
* @return #MHD_YES if there was a match, #MHD_NO if not
*/
static int
try_match_header (const char *prefix,
+ size_t prefix_len,
char *line,
char **suffix)
{
@@ -535,9 +537,9 @@
{
if (MHD_str_equal_caseless_n_ (prefix,
line,
- strlen (prefix)))
+ prefix_len))
{
- *suffix = strdup (&line[strlen (prefix)]);
+ *suffix = strdup (&line[prefix_len]);
return MHD_YES;
}
++line;
@@ -724,9 +726,11 @@
else
{
try_match_header ("Content-type: ",
+ MHD_STATICSTR_LEN_("Content-type: "),
buf,
&pp->content_type);
try_match_header ("Content-Transfer-Encoding: ",
+ MHD_STATICSTR_LEN_("Content-Transfer-Encoding: "),
buf,
&pp->content_transfer_encoding);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/microhttpd/response.c new/libmicrohttpd-0.9.65/src/microhttpd/response.c
--- old/libmicrohttpd-0.9.64/src/microhttpd/response.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/microhttpd/response.c 2019-06-23 21:20:42.000000000 +0200
@@ -974,7 +974,7 @@
to another protocol. */
buf = MHD_pool_allocate (pool,
avail,
- MHD_NO);
+ false);
}
/* use half the buffer for inbound, half for outbound */
urh->in_buffer_size = avail / 2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/testcurl/test_large_put.c new/libmicrohttpd-0.9.65/src/testcurl/test_large_put.c
--- old/libmicrohttpd-0.9.64/src/testcurl/test_large_put.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/testcurl/test_large_put.c 2019-06-23 21:20:42.000000000 +0200
@@ -202,7 +202,7 @@
d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | add_flag,
port,
NULL, NULL, &ahc_echo, &done_flag,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)),
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4 / 3)),
MHD_OPTION_END);
if (d == NULL)
return 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/src/testcurl/test_long_header.c new/libmicrohttpd-0.9.65/src/testcurl/test_long_header.c
--- old/libmicrohttpd-0.9.64/src/testcurl/test_long_header.c 2019-06-09 17:05:23.000000000 +0200
+++ new/libmicrohttpd-0.9.65/src/testcurl/test_long_header.c 2019-06-23 21:20:42.000000000 +0200
@@ -42,7 +42,7 @@
* half of this value, so the actual value does not have
* to be big at all...
*/
-#define VERY_LONG (1024*10)
+#define VERY_LONG (1024*8)
static int oneone;
@@ -94,7 +94,7 @@
static int
-testLongUrlGet ()
+testLongUrlGet (size_t buff_size)
{
struct MHD_Daemon *d;
CURL *c;
@@ -108,7 +108,7 @@
port = 0;
else
{
- port = 1330;
+ port = 1330 + buff_size % 20;
if (oneone)
port += 5;
}
@@ -122,7 +122,7 @@
&ahc_echo,
"GET",
MHD_OPTION_CONNECTION_MEMORY_LIMIT,
- (size_t) (VERY_LONG / 2), MHD_OPTION_END);
+ (size_t) buff_size, MHD_OPTION_END);
if (d == NULL)
return 1;
if (0 == port)
@@ -182,7 +182,7 @@
static int
-testLongHeaderGet ()
+testLongHeaderGet (size_t buff_size)
{
struct MHD_Daemon *d;
CURL *c;
@@ -197,7 +197,7 @@
port = 0;
else
{
- port = 1331;
+ port = 1331 + buff_size % 20;
if (oneone)
port += 5;
}
@@ -212,7 +212,7 @@
&ahc_echo,
"GET",
MHD_OPTION_CONNECTION_MEMORY_LIMIT,
- (size_t) (VERY_LONG / 2), MHD_OPTION_END);
+ (size_t) buff_size, MHD_OPTION_END);
if (d == NULL)
return 16;
if (0 == port)
@@ -288,8 +288,10 @@
oneone = has_in_name (argv[0], "11");
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
return 2;
- errorCount += testLongUrlGet ();
- errorCount += testLongHeaderGet ();
+ errorCount += testLongUrlGet (VERY_LONG / 2);
+ errorCount += testLongUrlGet (VERY_LONG / 2 + 978);
+ errorCount += testLongHeaderGet (VERY_LONG / 2);
+ errorCount += testLongHeaderGet (VERY_LONG / 2 + 1893);
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
curl_global_cleanup ();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libmicrohttpd-0.9.64/w32/common/microhttpd_dll_res_vc.rc new/libmicrohttpd-0.9.65/w32/common/microhttpd_dll_res_vc.rc
--- old/libmicrohttpd-0.9.64/w32/common/microhttpd_dll_res_vc.rc 2019-06-09 19:33:17.000000000 +0200
+++ new/libmicrohttpd-0.9.65/w32/common/microhttpd_dll_res_vc.rc 2019-07-05 22:22:30.000000000 +0200
@@ -4,8 +4,8 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,9,64,0
- PRODUCTVERSION 0,9,64,0
+ FILEVERSION 0,9,65,0
+ PRODUCTVERSION 0,9,65,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#if defined(_DEBUG)
FILEFLAGS VS_FF_DEBUG
@@ -21,8 +21,8 @@
BLOCK "04090000" /* Lang = US English, Charset = ASCII */
BEGIN
VALUE "ProductName", "GNU libmicrohttpd\0"
- VALUE "ProductVersion", "0.9.64\0"
- VALUE "FileVersion", "0.9.64\0"
+ VALUE "ProductVersion", "0.9.65\0"
+ VALUE "FileVersion", "0.9.65\0"
VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0"
VALUE "InternalName", "libmicrohttpd\0"
#if defined(_DEBUG)