23210175 Upgrade libmicrohttpd to 0.9.52
20404468 Re-enable HTTPS support once GnuTLS is cleared for consumption in Solaris
--- a/components/libmicrohttpd/Makefile Thu Mar 16 16:52:14 2017 -0700
+++ b/components/libmicrohttpd/Makefile Tue Feb 07 13:29:53 2017 +0100
@@ -26,13 +26,21 @@
include ../../make-rules/shared-macros.mk
COMPONENT_NAME = libmicrohttpd
-COMPONENT_VERSION = 0.9.37
+COMPONENT_VERSION = 0.9.52
COMPONENT_ARCHIVE_HASH = \
- sha256:a78cbcc050fb50f4ef4cf02709a3f8dd498e9230271b445fc3dbec4132b47cdc
+ sha256:54797f6e763d417627f89f60e4ae0a431dab0523f92f83def23ea02d0defafea
COMPONENT_BUGDB= library/libmicrohttpd
COMPONENT_ANITYA_ID= 1658
-TPNO = 18422
+TPNO = 32330
+
+# Use the compiler default 'xc99=all,no_lib' (specifically we want to prevent
+# autoconf from finding and using C11 Annex K bounds checking interfaces because
+# ON then won't be able to link with this library).
+studio_C99MODE=-xc99=all,no_lib
+
+# Needed for "gmake test" to work successfully.
+unexport SHELLOPTS
include $(WS_MAKE_RULES)/gnu-component.mk
@@ -40,12 +48,15 @@
CPPFLAGS += $(CPP_LARGEFILES)
-CONFIGURE_OPTIONS += --disable-https
-CONFIGURE_OPTIONS += --disable-spdy
CONFIGURE_OPTIONS += --includedir=$(USRINCDIR)/microhttpd
+PKG_CONFIG_PATHS.32 += /usr/lib/pkgconfig/gnutls-3
+PKG_CONFIG_PATHS.64 += /usr/lib/$(MACH64)/pkgconfig/gnutls-3
+PKG_CONFIG_PATHS += $(PKG_CONFIG_PATHS.$(BITS))
COMPONENT_TEST_ENV += PATH="$(GNUBIN):$(PATH)"
-# requires an older automake to reconfigure.
COMPONENT_PREP_ACTION += \
- (cd $(@D); ACLOCAL=aclocal-1.11 AUTOMAKE=automake-1.11 autoreconf -fiv);
+ (cd $(@D); ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf -fiv);
+
+REQUIRED_PACKAGES += library/gnutls-3
+REQUIRED_PACKAGES += system/library/security/libgcrypt
--- a/components/libmicrohttpd/libmicrohttpd.p5m Thu Mar 16 16:52:14 2017 -0700
+++ b/components/libmicrohttpd/libmicrohttpd.p5m Tue Feb 07 13:29:53 2017 +0100
@@ -18,7 +18,7 @@
#
# CDDL HEADER END
#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
#
<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
@@ -37,14 +37,19 @@
set name=org.opensolaris.arc-caseid value=PSARC/2014/289
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
file path=usr/include/microhttpd/microhttpd.h
-link path=usr/lib/$(MACH64)/libmicrohttpd.so target=libmicrohttpd.so.10.27.0
-link path=usr/lib/$(MACH64)/libmicrohttpd.so.10 target=libmicrohttpd.so.10.27.0
-file path=usr/lib/$(MACH64)/libmicrohttpd.so.10.27.0
+link path=usr/lib/$(MACH64)/libmicrohttpd.so target=libmicrohttpd.so.12.40.0
+# Compatibility symlink. Upstream bumped the version of the library by mistake;
+# 12.40.0 is still backwards-compatible with 10.*.
+link path=usr/lib/$(MACH64)/libmicrohttpd.so.10 target=libmicrohttpd.so.12.40.0
+link path=usr/lib/$(MACH64)/libmicrohttpd.so.12 target=libmicrohttpd.so.12.40.0
+file path=usr/lib/$(MACH64)/libmicrohttpd.so.12.40.0
file path=usr/lib/$(MACH64)/llib-lmicrohttpd.ln
file path=usr/lib/$(MACH64)/pkgconfig/libmicrohttpd.pc
-link path=usr/lib/libmicrohttpd.so target=libmicrohttpd.so.10.27.0
-link path=usr/lib/libmicrohttpd.so.10 target=libmicrohttpd.so.10.27.0
-file path=usr/lib/libmicrohttpd.so.10.27.0
+link path=usr/lib/libmicrohttpd.so target=libmicrohttpd.so.12.40.0
+# Compatibility link. See above.
+link path=usr/lib/libmicrohttpd.so.10 target=libmicrohttpd.so.12.40.0
+link path=usr/lib/libmicrohttpd.so.12 target=libmicrohttpd.so.12.40.0
+file path=usr/lib/libmicrohttpd.so.12.40.0
file path=usr/lib/llib-lmicrohttpd
file path=usr/lib/llib-lmicrohttpd.ln
file path=usr/lib/pkgconfig/libmicrohttpd.pc
--- a/components/libmicrohttpd/patches/001.patch Thu Mar 16 16:52:14 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-Tomas Heran <[email protected]>
-Fix to configure to not use -fno-strict-aliasing and -fvisibility=hidden with
-Solaris Studio cc as it doesn't like it for dynamic stuff.
-Reported upstream as: https://gnunet.org/bugs/view.php?id=3584
-
-diff -r 4a6b889815b1 -r dcb95cb7b865 configure.ac
---- a/configure.ac Thu Sep 04 20:38:52 2014 +0200
-+++ b/configure.ac Thu Dec 18 21:16:20 2014 +0100
-@@ -248,7 +248,7 @@
-
- # set GCC options
- # use '-fno-strict-aliasing', but only if the compiler can take it
--AX_APPEND_COMPILE_FLAGS([[-fno-strict-aliasing]])
-+# AX_APPEND_COMPILE_FLAGS([[-fno-strict-aliasing]])
-
- AC_C_BIGENDIAN
-
-@@ -435,23 +435,23 @@
- # TCP_CORK and TCP_NOPUSH
- AC_CHECK_DECLS([TCP_CORK, TCP_NOPUSH], [], [], [[#include <netinet/tcp.h>]])
-
--HIDDEN_VISIBILITY_CFLAGS=""
--case "$host" in
-- *-*-mingw*)
-- dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
-- AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
-- [defines how to decorate public symbols while building])
-- HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
-- ;;
-- *)
-- dnl on other compilers, check if we can do -fvisibility=hidden
-- AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
-- [AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) extern],
-- [defines how to decorate public symbols while building])
-- HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"])
-- ;;
--esac
--AC_SUBST(HIDDEN_VISIBILITY_CFLAGS)
-+# HIDDEN_VISIBILITY_CFLAGS=""
-+# case "$host" in
-+# *-*-mingw*)
-+# dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
-+# AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
-+# [defines how to decorate public symbols while building])
-+# HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
-+# ;;
-+# *)
-+# dnl on other compilers, check if we can do -fvisibility=hidden
-+# AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
-+# [AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) extern],
-+# [defines how to decorate public symbols while building])
-+# HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"])
-+# ;;
-+# esac
-+# AC_SUBST(HIDDEN_VISIBILITY_CFLAGS)
-
- # libcurl (required for testing)
- AC_ARG_ENABLE([curl],
--- a/components/libmicrohttpd/patches/002.patch Thu Mar 16 16:52:14 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-Tomas Heran <[email protected]>
-Make MHD_http_unescape available to library users.
-Reported upstream as: https://gnunet.org/bugs/view.php?id=3585
-
-diff -r dcb95cb7b865 -r efe4a6fcacd1 src/include/microhttpd.h
---- a/src/include/microhttpd.h Thu Dec 18 21:16:20 2014 +0100
-+++ b/src/include/microhttpd.h Thu Dec 18 21:49:28 2014 +0100
-@@ -2477,6 +2477,21 @@
- _MHD_EXTERN int
- MHD_is_feature_supported(enum MHD_FEATURE feature);
-
-+/**
-+ * Process escape sequences ('+'=space, %HH) Updates val in place; the
-+ * result should be UTF-8 encoded and cannot be larger than the input.
-+ * The result must also still be 0-terminated.
-+ *
-+ * @param cls closure (use NULL)
-+ * @param connection handle to connection, not used
-+ * @param val value to unescape (modified in the process)
-+ * @return length of the resulting val (strlen(val) maybe
-+ * shorter afterwards due to elimination of escape sequences)
-+ */
-+size_t
-+MHD_http_unescape (void *cls,
-+ struct MHD_Connection *connection,
-+ char *val);
-
- #if 0 /* keep Emacsens' auto-indent happy */
- {
-diff -r dcb95cb7b865 -r efe4a6fcacd1 src/microhttpd/internal.h
---- a/src/microhttpd/internal.h Thu Dec 18 21:16:20 2014 +0100
-+++ b/src/microhttpd/internal.h Thu Dec 18 21:49:28 2014 +0100
-@@ -200,23 +200,6 @@
- #endif
-
- /**
-- * Process escape sequences ('+'=space, %HH) Updates val in place; the
-- * result should be UTF-8 encoded and cannot be larger than the input.
-- * The result must also still be 0-terminated.
-- *
-- * @param cls closure (use NULL)
-- * @param connection handle to connection, not used
-- * @param val value to unescape (modified in the process)
-- * @return length of the resulting val (strlen(val) maybe
-- * shorter afterwards due to elimination of escape sequences)
-- */
--size_t
--MHD_http_unescape (void *cls,
-- struct MHD_Connection *connection,
-- char *val);
--
--
--/**
- * Header or cookie in HTTP request or response.
- */
- struct MHD_HTTP_Header
--- a/components/libmicrohttpd/patches/003.patch Thu Mar 16 16:52:14 2017 -0700
+++ b/components/libmicrohttpd/patches/003.patch Tue Feb 07 13:29:53 2017 +0100
@@ -3,30 +3,20 @@
rather an object that has recv and send "methods".
NOTE: This RFE hasn't been shared with upstream yet.
-diff -r efe4a6fcacd1 -r 6d80d5999249 src/include/microhttpd.h
---- a/src/include/microhttpd.h Thu Dec 18 21:49:28 2014 +0100
-+++ b/src/include/microhttpd.h Thu Dec 18 21:49:28 2014 +0100
-@@ -285,7 +285,7 @@
- * with the SHOUTcast "ICY" line instad of "HTTP".
- * @ingroup specialized
- */
--#define MHD_ICY_FLAG ((uint32_t)(1 << 31))
-+#define MHD_ICY_FLAG ((uint32_t)((uint32_t)1 << 31))
-
- /**
- * @defgroup headers HTTP headers
-@@ -562,7 +562,9 @@
- * kernel >= 3.6. On other systems, using this option cases #MHD_start_daemon
- * to fail.
+diff -r 8cabd8ab3e3b -r 0b399364b890 src/include/microhttpd.h
+--- a/src/include/microhttpd.h Fri Oct 21 16:18:03 2016 +0200
++++ b/src/include/microhttpd.h Fri Oct 21 16:28:01 2016 +0200
+@@ -693,7 +693,8 @@
+ * open up an extra file descriptor, which we do not want to do
+ * unless necessary.
*/
-- MHD_USE_TCP_FASTOPEN = 16384
-+ MHD_USE_TCP_FASTOPEN = 16384,
-+
-+ MHD_USE_STREAM_CONNS = 32768
+- MHD_USE_TLS_EPOLL_UPGRADE = 32768 | MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL | MHD_USE_TLS
++ MHD_USE_TLS_EPOLL_UPGRADE = 32768 | MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL | MHD_USE_TLS,
++ MHD_USE_STREAM_CONNS = 65536 | MHD_USE_NO_LISTEN_SOCKET
};
-@@ -1445,6 +1447,16 @@
+@@ -1698,6 +1699,16 @@
const struct sockaddr *addr,
socklen_t addrlen);
@@ -38,26 +28,26 @@
+ ssize_t (*send_cls_u) (struct MHD_Connection * conn,
+ const void *write_to, size_t max_bytes));
+
-+void * MHD_get_stream_connection_data(struct MHD_Connection *conn);
++_MHD_EXTERN void * MHD_get_stream_connection_data(struct MHD_Connection *conn);
+
/**
* Obtain the `select()` sets for this daemon.
-diff -r efe4a6fcacd1 -r 6d80d5999249 src/microhttpd/connection.c
---- a/src/microhttpd/connection.c Thu Dec 18 21:49:28 2014 +0100
-+++ b/src/microhttpd/connection.c Thu Dec 18 21:49:28 2014 +0100
-@@ -2565,7 +2565,7 @@
- connection,
- &connection->client_context,
- MHD_REQUEST_TERMINATED_COMPLETED_OK);
-- connection->client_aware = MHD_NO;
-+ //connection->client_aware = MHD_NO;
- }
- end =
- MHD_lookup_connection_value (connection, MHD_HEADER_KIND,
-@@ -2599,7 +2599,13 @@
- connection->read_buffer,
- connection->read_buffer_size);
+@@ -1931,7 +1942,7 @@
+ * shorter afterwards due to elimination of escape sequences)
+ */
+ _MHD_EXTERN size_t
+-MHD_http_unescape (char *val);
++MHD_http_unescape (void *, void *, char *val);
+
+
+ /**
+diff -r 8cabd8ab3e3b -r 0b399364b890 src/microhttpd/connection.c
+--- a/src/microhttpd/connection.c Fri Oct 21 16:18:03 2016 +0200
++++ b/src/microhttpd/connection.c Fri Oct 21 16:28:01 2016 +0200
+@@ -3038,7 +3038,13 @@
+ connection->read_buffer_size
+ = connection->daemon->pool_size / 2;
}
- connection->client_aware = MHD_NO;
+ /*
@@ -70,10 +60,10 @@
connection->client_context = NULL;
connection->continue_message_write_offset = 0;
connection->responseCode = 0;
-diff -r efe4a6fcacd1 -r 6d80d5999249 src/microhttpd/daemon.c
---- a/src/microhttpd/daemon.c Thu Dec 18 21:49:28 2014 +0100
-+++ b/src/microhttpd/daemon.c Thu Dec 18 21:49:28 2014 +0100
-@@ -1131,7 +1131,10 @@
+diff -r 8cabd8ab3e3b -r 0b399364b890 src/microhttpd/daemon.c
+--- a/src/microhttpd/daemon.c Fri Oct 21 16:18:03 2016 +0200
++++ b/src/microhttpd/daemon.c Fri Oct 21 16:28:01 2016 +0200
+@@ -1767,7 +1767,10 @@
MHD_socket client_socket,
const struct sockaddr *addr,
socklen_t addrlen,
@@ -84,28 +74,24 @@
+ void *callback_data)
{
struct MHD_Connection *connection;
- int res_thread_create;
-@@ -1150,7 +1153,10 @@
- return internal_add_connection (&daemon->worker_pool[(i + client_socket) % daemon->worker_pool_size],
- client_socket,
- addr, addrlen,
-- external_add);
-+ external_add,
-+ recv_cls_u,
-+ send_cls_u,
-+ callback_data);
+ unsigned int i;
+@@ -1790,7 +1793,10 @@
+ client_socket,
+ addr,
+ addrlen,
+- external_add);
++ external_add,
++ recv_cls_u,
++ send_cls_u,
++ callback_data);
+ }
/* all pools are at their connection limit, must refuse */
- if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
-@@ -1288,10 +1294,21 @@
+ MHD_socket_close_chk_ (client_socket);
+@@ -1944,7 +1950,20 @@
+ connection->recv_cls = &recv_param_adapter;
+ connection->send_cls = &send_param_adapter;
- /* set default connection handlers */
- MHD_set_http_callbacks_ (connection);
-- connection->recv_cls = &recv_param_adapter;
-- connection->send_cls = &send_param_adapter;
--
- if (0 == (connection->daemon->options & MHD_USE_EPOLL_TURBO))
-+
+ if (recv_cls_u == NULL)
+ connection->recv_cls = &recv_param_adapter;
+ else
@@ -121,19 +107,28 @@
+ if (0 == (connection->daemon->options & MHD_USE_EPOLL_TURBO) &&
+ 0 == (connection->daemon->options & MHD_USE_STREAM_CONNS))
{
- /* non-blocking sockets are required on most systems and for GNUtls;
- however, they somehow cause serious problems on CYGWIN (#1824);
-@@ -1746,11 +1763,29 @@
- socklen_t addrlen)
- {
- make_nonblocking_noninheritable (daemon,
-- client_socket);
-+ client_socket);
- return internal_add_connection (daemon,
+ /* in turbo mode, we assume that non-blocking was already set
+ by 'accept4' or whoever calls 'MHD_add_connection' */
+@@ -1952,8 +1971,8 @@
+ {
+ #ifdef HAVE_MESSAGES
+ MHD_DLOG (connection->daemon,
+- _("Failed to set nonblocking mode on connection socket: %s\n"),
+- MHD_socket_last_strerr_());
++ _("Failed to set nonblocking mode on connection socket %d %d: %s\n"),
++ connection->socket_fd, connection->daemon->options, MHD_socket_last_strerr_());
+ #endif
+ }
+ }
+@@ -2379,7 +2398,28 @@
client_socket,
- addr, addrlen,
+ addr,
+ addrlen,
- MHD_YES);
-+ MHD_YES, NULL, NULL, NULL);
++ MHD_YES,
++ NULL,
++ NULL,
++ NULL);
+}
+
+int
@@ -155,22 +150,25 @@
}
-@@ -1826,7 +1861,7 @@
- #endif
- (void) internal_add_connection (daemon, s,
- addr, addrlen,
+@@ -2501,7 +2541,10 @@
+ s,
+ addr,
+ addrlen,
- MHD_NO);
-+ MHD_NO, NULL, NULL, NULL);
++ MHD_NO,
++ NULL,
++ NULL,
++ NULL);
return MHD_YES;
}
-@@ -2097,6 +2132,45 @@
+@@ -2793,6 +2836,45 @@
return MHD_YES;
}
+/**
+ */
-+static int
++int
+MHD_poll_stream_conns (struct MHD_Daemon *daemon,
+ int may_block)
+{
@@ -210,39 +208,141 @@
/**
* Main internal select() call. Will compute select sets, call select()
-@@ -2675,6 +2749,11 @@
+@@ -3655,7 +3737,12 @@
MHD_cleanup_connections (daemon);
}
#endif
+- else
+ else if (0 != (daemon->options & MHD_USE_STREAM_CONNS))
+ {
+ MHD_poll_stream_conns (daemon, MHD_NO);
+ MHD_cleanup_connections (daemon);
+ }
- else
++ else
{
MHD_select (daemon, MHD_NO);
-diff -r efe4a6fcacd1 -r 6d80d5999249 src/microhttpd/internal.h
---- a/src/microhttpd/internal.h Thu Dec 18 21:49:28 2014 +0100
-+++ b/src/microhttpd/internal.h Thu Dec 18 21:49:28 2014 +0100
-@@ -803,6 +803,11 @@
- */
+ /* MHD_select does MHD_cleanup_connections already */
+@@ -3753,7 +3840,7 @@
+ struct MHD_Connection *connection,
+ char *val)
+ {
+- return MHD_http_unescape (val);
++ return MHD_http_unescape (NULL, NULL, val);
+ }
+
+
+@@ -4880,36 +4967,38 @@
+ socket_fd = daemon->socket_fd;
+ }
+
+- if (!MHD_socket_nonblocking_ (socket_fd))
+- {
++ if (MHD_INVALID_SOCKET != socket_fd) {
++ if (!MHD_socket_nonblocking_ (socket_fd))
++ {
+ #ifdef HAVE_MESSAGES
+- MHD_DLOG (daemon,
+- _("Failed to set nonblocking mode on listening socket: %s\n"),
+- MHD_socket_last_strerr_());
+-#endif
+- if (0 != (flags & MHD_USE_EPOLL) ||
+- daemon->worker_pool_size > 0)
+- {
+- /* Accept must be non-blocking. Multiple children may wake up
+- * to handle a new connection, but only one will win the race.
+- * The others must immediately return. */
+- MHD_socket_close_chk_ (socket_fd);
+- goto free_and_fail;
+- }
+- }
+- if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd,
+- NULL)) &&
+- (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
+- {
++ MHD_DLOG (daemon,
++ _("Failed to set nonblocking mode on listening socket: %s\n"),
++ MHD_socket_last_strerr_());
++#endif
++ if (0 != (flags & MHD_USE_EPOLL) ||
++ daemon->worker_pool_size > 0)
++ {
++ /* Accept must be non-blocking. Multiple children may wake up
++ * to handle a new connection, but only one will win the race.
++ * The others must immediately return. */
++ MHD_socket_close_chk_ (socket_fd);
++ goto free_and_fail;
++ }
++ }
++ if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd,
++ NULL)) &&
++ (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
++ {
+ #ifdef HAVE_MESSAGES
+- MHD_DLOG (daemon,
+- _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"),
+- socket_fd,
+- FD_SETSIZE);
+-#endif
+- MHD_socket_close_chk_ (socket_fd);
+- goto free_and_fail;
+- }
++ MHD_DLOG (daemon,
++ _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"),
++ socket_fd,
++ FD_SETSIZE);
++#endif
++ MHD_socket_close_chk_ (socket_fd);
++ goto free_and_fail;
++ }
++ }
+
+ #ifdef EPOLL_SUPPORT
+ if ( (0 != (flags & MHD_USE_EPOLL)) &&
+diff -r 8cabd8ab3e3b -r 0b399364b890 src/microhttpd/internal.c
+--- a/src/microhttpd/internal.c Fri Oct 21 16:18:03 2016 +0200
++++ b/src/microhttpd/internal.c Fri Oct 21 16:28:01 2016 +0200
+@@ -135,7 +135,7 @@
+ * shorter afterwards due to elimination of escape sequences)
+ */
+ size_t
+-MHD_http_unescape (char *val)
++MHD_http_unescape (void *ign1, void *ign2, char *val)
+ {
+ char *rpos = val;
+ char *wpos = val;
+diff -r 8cabd8ab3e3b -r 0b399364b890 src/microhttpd/internal.h
+--- a/src/microhttpd/internal.h Fri Oct 21 16:18:03 2016 +0200
++++ b/src/microhttpd/internal.h Fri Oct 21 16:28:01 2016 +0200
+@@ -881,6 +881,11 @@
TransmitCallback send_cls;
-+ /**
+ /**
+ * User specified data that's associated with a connection.
+ */
+ void *callback_data;
+
- #if HTTPS_SUPPORT
- /**
- * State required for HTTPS/SSL/TLS support.
-@@ -1050,7 +1055,7 @@
- /**
- * Number of worker daemons
- */
-- unsigned int worker_pool_size;
-+ unsigned long long worker_pool_size;
-
- /**
- * The select thread handle (if we have internal select)
++ /**
+ * If this connection was upgraded and if we are using
+ * #MHD_USE_THREAD_PER_CONNECTION or #MHD_USE_TLS, this points to
+ * the upgrade response details such that the
+diff -r 8cabd8ab3e3b -r 0b399364b890 src/microhttpd/postprocessor.c
+--- a/src/microhttpd/postprocessor.c Fri Oct 21 16:18:03 2016 +0200
++++ b/src/microhttpd/postprocessor.c Fri Oct 21 16:28:01 2016 +0200
+@@ -394,7 +394,7 @@
+ buf[pp->buffer_pos] = '\0'; /* 0-terminate key */
+ pp->buffer_pos = 0; /* reset for next key */
+ MHD_unescape_plus (buf);
+- MHD_http_unescape (buf);
++ MHD_http_unescape (NULL, NULL, buf);
+ poff += equals + 1;
+ pp->state = PP_ProcessValue;
+ pp->value_offset = 0;
+@@ -460,7 +460,7 @@
+ /* unescape */
+ xbuf[xoff] = '\0'; /* 0-terminate in preparation */
+ MHD_unescape_plus (xbuf);
+- xoff = MHD_http_unescape (xbuf);
++ xoff = MHD_http_unescape (NULL, NULL, xbuf);
+ /* finally: call application! */
+ pp->must_ikvi = MHD_NO;
+ if (MHD_NO == pp->ikvi (pp->cls,
--- a/components/libmicrohttpd/patches/004.patch Thu Mar 16 16:52:14 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-Tomas Heran <[email protected]>
-This patch will not be reported upstream.
-
-diff -r 2b3bbde72bcd -r 92407d8c9b87 doc/libmicrohttpd.3
---- a/doc/libmicrohttpd.3 Mon Jan 26 16:56:08 2015 +0100
-+++ b/doc/libmicrohttpd.3 Thu Feb 05 13:03:58 2015 +0100
-@@ -33,3 +33,6 @@
-
- .SH "AVAILABILITY"
- You can obtain the latest version from http://www.gnu.org/software/libmicrohttpd/.
-+
-+.SH "CAVEATS"
-+This library, as delivered by Oracle Solaris in binary form, has been compiled without HTTPS support, i.e. \fB--disable-https\fP option was used when configuring the library for compilation.
--- a/components/libmicrohttpd/patches/005.patch Thu Mar 16 16:52:14 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-Tomas Heran <[email protected]>
-libnsl and libsocket need to be linked to on Solaris 11 for socket API.
-Reported upstream as: https://gnunet.org/bugs/view.php?id=3752
-
-diff -r d118e0f483a4 configure.ac
---- a/configure.ac Thu Feb 05 14:49:09 2015 +0100
-+++ b/configure.ac Thu Apr 09 16:39:50 2015 +0200
-@@ -135,6 +135,8 @@
- *solaris*)
- AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
- AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
-+ AC_SEARCH_LIBS(gethostbyname, nsl)
-+ AC_SEARCH_LIBS(socket, socket)
- ;;
- *arm-linux*)
- AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libmicrohttpd/patches/006.patch Tue Feb 07 13:29:53 2017 +0100
@@ -0,0 +1,83 @@
+Tomas Heran <[email protected]>
+pthread_kill(pid, 0) on Solaris 12 doesn't return ESRCH for a thread that has
+not been detached or pthread_join()'ed.
+Upstream bug: https://gnunet.org/bugs/view.php?id=4884
+
+diff -r ba9a7ed454dd -r e3e34f3524be src/testcurl/perf_get_concurrent.c
+--- a/src/testcurl/perf_get_concurrent.c Fri Oct 21 16:28:03 2016 +0200
++++ b/src/testcurl/perf_get_concurrent.c Tue Feb 07 13:10:29 2017 +0100
+@@ -60,6 +60,8 @@
+ */
+ #define PAR CPU_COUNT
+
++static char *g_do_gets_err = NULL;
++
+ /**
+ * Do we use HTTP 1.1?
+ */
+@@ -215,6 +217,7 @@
+ {
+ for (j--; j >= 0; j--)
+ pthread_join(par[j], NULL);
++ g_do_gets_err = "pthread_create error";
+ return "pthread_create error";
+ }
+ }
+@@ -225,6 +228,7 @@
+ NULL != ret_val)
+ err = ret_val;
+ }
++ g_do_gets_err = err;
+ return err;
+ }
+
+@@ -318,7 +322,6 @@
+ struct timeval tv;
+ MHD_UNSIGNED_LONG_LONG tt;
+ int tret;
+- char *ret_val;
+ int ret = 0;
+
+ d = MHD_start_daemon (MHD_USE_DEBUG,
+@@ -330,6 +333,11 @@
+ MHD_stop_daemon(d);
+ return 512;
+ }
++ if (0 != pthread_detach(pid))
++ {
++ MHD_stop_daemon(d);
++ return 512;
++ }
+ start_timer ();
+ while (ESRCH != pthread_kill (pid, 0))
+ {
+@@ -354,20 +362,20 @@
+ "select failed: %s\n",
+ strerror (errno));
+ ret |= 1024;
+- break;
++ break;
+ }
+ MHD_run_from_select(d, &rs, &ws, &es);
+ }
+
+ stop ("external select");
+ MHD_stop_daemon (d);
+- if (0 != pthread_join(pid, (void**)&ret_val) ||
+- NULL != ret_val)
+- {
+- fprintf (stderr,
+- "%s\n", ret_val);
+- ret |= 8;
+- }
++
++ if (g_do_gets_err != NULL)
++ {
++ fprintf (stderr, "%s\n", g_do_gets_err);
++ ret |= 8;
++ }
++
+ if (ret)
+ fprintf (stderr, "Error performing test.\n");
+ return 0;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libmicrohttpd/patches/007.patch Tue Feb 07 13:29:53 2017 +0100
@@ -0,0 +1,24 @@
+Tomas Heran <[email protected]>
+Upstream bug: https://gnunet.org/bugs/view.php?id=4815
+
+diff -r 34a8823ef56c -r 89e444406b37 src/microhttpd/mhd_itc.c
+--- a/src/microhttpd/mhd_itc.c Fri Feb 03 14:25:16 2017 +0100
++++ b/src/microhttpd/mhd_itc.c Fri Feb 03 14:25:18 2017 +0100
+@@ -40,7 +40,7 @@
+ /**
+ * Change itc FD options to be non-blocking.
+ *
+- * @param pip the pipe to manipulate
++ * @param itc the pipe to manipulate
+ * @return non-zero if succeeded, zero otherwise
+ */
+ int
+@@ -58,7 +58,7 @@
+ return 0;
+
+ if ( ((flags | O_NONBLOCK) != flags) &&
+- (0 != fcntl (pip.fd[i],
++ (0 != fcntl (itc.fd[i],
+ F_SETFL,
+ flags | O_NONBLOCK)) )
+ return 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libmicrohttpd/patches/009.patch Tue Feb 07 13:29:53 2017 +0100
@@ -0,0 +1,15 @@
+Tomas Heran <[email protected]>
+Relax the gettext version requirement. Will not be reported upstream.
+
+diff -r 4efb170d3a5e -r 8da9a2931d0d configure.ac
+--- a/configure.ac Fri Feb 03 14:25:22 2017 +0100
++++ b/configure.ac Fri Feb 03 16:01:35 2017 +0100
+@@ -36,7 +36,7 @@
+
+ # check for gettext
+ AM_GNU_GETTEXT([external])
+-AM_GNU_GETTEXT_VERSION([0.19.8])
++AM_GNU_GETTEXT_VERSION([0.19])
+
+ AC_MSG_CHECKING([[whether z/OS special settings are required]])
+ if test `uname -s` = "OS/390"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libmicrohttpd/patches/010.patch Tue Feb 07 13:29:53 2017 +0100
@@ -0,0 +1,26 @@
+Tomas Heran <[email protected]>
+Solaris Studio understands __attribute__ ((constructor|destructor)) as well as
+GNU C.
+Upstream bug: https://gnunet.org/bugs/view.php?id=4887
+
+diff -r d61abfd2e00c -r 035e9e268ad6 src/include/autoinit_funcs.h
+--- a/src/include/autoinit_funcs.h Wed Feb 08 12:57:20 2017 +0100
++++ b/src/include/autoinit_funcs.h Fri Feb 10 14:17:39 2017 +0100
+@@ -67,7 +67,7 @@
+ */
+ #define AUTOINIT_FUNCS_VERSION 0x01000001
+
+-#if defined(__GNUC__)
++#if defined(__GNUC__) || defined(__SUNPRO_C)
+ #/* if possible - check for supported attribute */
+ #ifdef __has_attribute
+ #if !__has_attribute(constructor) || !__has_attribute(destructor)
+@@ -76,7 +76,7 @@
+ #endif /* __has_attribute */
+ #endif /* __GNUC__ */
+
+-#if defined(__GNUC__) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED)
++#if (defined(__GNUC__) || defined(__SUNPRO_C)) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED)
+
+ #define GNUC_SET_INIT_AND_DEINIT(FI,FD) \
+ void __attribute__ ((constructor)) _GNUC_init_helper_##FI(void) \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libmicrohttpd/patches/011.patch Tue Feb 07 13:29:53 2017 +0100
@@ -0,0 +1,23 @@
+Tomas Heran <[email protected]>
+Race condition between MHD_cleanup_connections() and "upgrading" a connection.
+Upstream bug: https://gnunet.org/bugs/view.php?id=4889
+
+diff -r d61abfd2e00c -r c333f93356f1 src/microhttpd/response.c
+--- a/src/microhttpd/response.c Wed Feb 08 12:57:20 2017 +0100
++++ b/src/microhttpd/response.c Thu Feb 09 09:28:17 2017 -0800
+@@ -675,6 +675,7 @@
+ connection->response = NULL;
+ }
+
++ MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
+ if (MHD_INVALID_SOCKET != connection->socket_fd)
+ {
+ shutdown (connection->socket_fd,
+@@ -682,6 +683,7 @@
+ MHD_socket_close_chk_ (connection->socket_fd);
+ connection->socket_fd = MHD_INVALID_SOCKET;
+ }
++ MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
+ return MHD_YES;
+ }
+ /* 'upgraded' resources are not needed anymore - cleanup now */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/libmicrohttpd/patches/012.patch Tue Feb 07 13:29:53 2017 +0100
@@ -0,0 +1,16 @@
+Tomas Heran <[email protected]>
+Typo in configure.ac when pkg-config is used to find GnuTLS library.
+Upstream bug: https://gnunet.org/bugs/view.php?id=4888
+
+diff -r 1cf9eb13b637 -r 8bd4ec7772bc configure.ac
+--- a/configure.ac Tue Feb 14 13:06:13 2017 +0100
++++ b/configure.ac Tue Feb 14 13:06:35 2017 +0100
+@@ -1025,7 +1025,7 @@
+ [
+ AC_MSG_RESULT([[yes]])
+ have_gnutls=yes
+- GNUTLS_CPPLAGS="$GNUTLS_CFLAGS"
++ GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS"
+ GNUTLS_LDFLAGS="$GNUTLS_LIBS"
+ AC_MSG_CHECKING([[for gnutls_privkey_import_x509_raw()]])
+ AC_LINK_IFELSE([