gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (6c751386 -> ec591a70)


From: gnunet
Subject: [libmicrohttpd] branch master updated (6c751386 -> ec591a70)
Date: Fri, 16 Apr 2021 13:24:04 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 6c751386 fix #6768: do not use TCP-specific syscalls on UNIX domain 
sockets (merge)
     new a1371a29 init refactoring: always call MHD_send_init_static_vars_()
     new b6a3e50b mhd_send: use run-time value of IOV_MAX if available
     new ec591a70 configure: corrected displayed licence

The 3 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:
 configure.ac              |  4 +--
 src/microhttpd/daemon.c   |  2 --
 src/microhttpd/mhd_send.c | 79 ++++++++++++++++++++++++++++++++++++++++-------
 src/microhttpd/mhd_send.h |  3 --
 4 files changed, 69 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index e9c1e03b..88b75357 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2454,10 +2454,10 @@ AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} 
Configuration Summary:
 
 AS_IF([test "x$enable_https" = "xyes"],
  [AC_MSG_NOTICE([HTTPS subsystem configuration:
-  License         :  LGPL only
+  License         :  LGPLv2.1+ only
  ])],
  [AC_MSG_NOTICE([
-  License         :  LGPL or eCos
+  License         :  LGPLv2.1+ or eCos
  ])])
 
 AS_IF([test "x$enable_bauth" != "xyes" || \
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index d3b9958d..fde1703d 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -8015,9 +8015,7 @@ MHD_init (void)
   gnutls_global_init ();
 #endif /* HTTPS_SUPPORT */
   MHD_monotonic_sec_counter_init ();
-#ifdef HAVE_FREEBSD_SENDFILE
   MHD_send_init_static_vars_ ();
-#endif /* HAVE_FREEBSD_SENDFILE */
   MHD_init_mem_pools_ ();
 }
 
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 3810e121..e8ae35d2 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -47,6 +47,9 @@
 /* For FreeBSD version identification */
 #include <sys/param.h>
 #endif /* HAVE_SYS_PARAM_H */
+#ifdef HAVE_SYSCONF
+#include <unistd.h>
+#endif /* HAVE_SYSCONF */
 #include "mhd_assert.h"
 
 #include "mhd_limits.h"
@@ -81,17 +84,14 @@ static int freebsd_sendfile_flags_;
  * FreeBSD sendfile() flags for thread-per-connection
  */
 static int freebsd_sendfile_flags_thd_p_c_;
-#endif /* SF_FLAGS */
+
+
 /**
- * Initialises static variables
+ * Initialises variables for FreeBSD's sendfile()
  */
-void
-MHD_send_init_static_vars_ (void)
+static void
+freebsd_sendfile_init_ (void)
 {
-/* FreeBSD 11 and later allow to specify read-ahead size
- * and handles SF_NODISKIO differently.
- * SF_FLAGS defined only on FreeBSD 11 and later. */
-#ifdef SF_FLAGS
   long sys_page_size = sysconf (_SC_PAGESIZE);
   if (0 >= sys_page_size)
   {   /* Failed to get page size. */
@@ -107,11 +107,63 @@ MHD_send_init_static_vars_ (void)
       SF_FLAGS ((uint16_t) ((MHD_SENFILE_CHUNK_THR_P_C_ + sys_page_size - 1)
                             / sys_page_size), SF_NODISKIO);
   }
+}
+
+
 #endif /* SF_FLAGS */
+#endif /* HAVE_FREEBSD_SENDFILE */
+
+
+#if defined(HAVE_SYSCONF) && defined(_SC_IOV_MAX)
+/**
+ * Current IOV_MAX system value
+ */
+static unsigned long mhd_iov_max_ = 0;
+
+static void
+iov_max_init_ (void)
+{
+  long res = sysconf (_SC_IOV_MAX);
+  if (res >= 0)
+    mhd_iov_max_ = res;
+#if defined(IOV_MAX)
+  else
+    mhd_iov_max_ = IOV_MAX;
+#endif /* IOV_MAX */
 }
 
 
+/**
+ * IOV_MAX (run-time) value
+ */
+#define _MHD_IOV_MAX    mhd_iov_max_
+#elif defined(IOV_MAX)
+
+/**
+ * IOV_MAX (static) value
+ */
+#define _MHD_IOV_MAX    IOV_MAX
+#endif /* HAVE_SYSCONF && _SC_IOV_MAX */
+
+
+/**
+ * Initialises static variables
+ */
+void
+MHD_send_init_static_vars_ (void)
+{
+#ifdef HAVE_FREEBSD_SENDFILE
+  /* FreeBSD 11 and later allow to specify read-ahead size
+   * and handles SF_NODISKIO differently.
+   * SF_FLAGS defined only on FreeBSD 11 and later. */
+#ifdef SF_FLAGS
+  freebsd_sendfile_init_ (void);
+#endif /* SF_FLAGS */
 #endif /* HAVE_FREEBSD_SENDFILE */
+#if defined(HAVE_SYSCONF) && defined(_SC_IOV_MAX)
+  iov_max_init_ ();
+#endif /* HAVE_SYSCONF && _SC_IOV_MAX */
+}
 
 
 bool
@@ -1296,13 +1348,16 @@ send_iov_nontls (struct MHD_Connection *connection,
   }
 
   items_to_send = r_iov->cnt - r_iov->sent;
-#ifdef IOV_MAX
-  if (IOV_MAX < items_to_send)
+#ifdef _MHD_IOV_MAX
+  if (_MHD_IOV_MAX < items_to_send)
   {
-    items_to_send = IOV_MAX;
+    mhd_assert (0 < _MHD_IOV_MAX);
+    if (0 == _MHD_IOV_MAX)
+      return MHD_ERR_NOTCONN_; /* Should never happen */
+    items_to_send = _MHD_IOV_MAX;
     push_data = false; /* Incomplete response */
   }
-#endif /* IOV_MAX */
+#endif /* _MHD_IOV_MAX */
 #ifdef HAVE_SENDMSG
   memset (&msg, 0, sizeof(struct msghdr));
   msg.msg_iov = r_iov->iov + r_iov->sent;
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h
index d4ee8de7..57f6319b 100644
--- a/src/microhttpd/mhd_send.h
+++ b/src/microhttpd/mhd_send.h
@@ -46,15 +46,12 @@
 #define MHD_VECT_SEND 1
 #endif /* HAVE_SENDMSG || HAVE_WRITEV || MHD_WINSOCK_SOCKETS */
 
-#ifdef HAVE_FREEBSD_SENDFILE
 /**
  * Initialises static variables
  */
 void
 MHD_send_init_static_vars_ (void);
 
-#endif /* HAVE_FREEBSD_SENDFILE */
-
 
 /**
  * Send buffer to the client, push data from network buffer if requested

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