gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (90fcf2fc -> 75e2addd)


From: gnunet
Subject: [libmicrohttpd] branch master updated (90fcf2fc -> 75e2addd)
Date: Wed, 01 Nov 2023 11:52:15 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 90fcf2fc websocket_threaded_example: fix websocket url string
     new 492bce05 digestauth: added asserts, fixed internal doxy
     new e60359c0 Upgraded connection: cosmetics
     new 83f9a5d7 daemon.c: cosmetics
     new 159bbfd5 daemon: muted possible compiler warning
     new 5d195d92 microhttpd.h: updated doxy for MHD_USE_PEDANTIC_CHECKS
     new c5a84732 configure: cosmetics
     new 934d0f52 configure: warn if building without threads
     new 6e98d635 configure: added detection of FD_SETSIZE value and ability to 
override it
     new 5f8e3c9b Adjusted default value of maximum connections
     new 75e2addd internal.h: added macros for polling mode detection

The 10 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                | 507 +++++++++++++++++++++++++++++++++++++++++++-
 src/include/microhttpd.h    |   9 +-
 src/microhttpd/daemon.c     |  16 +-
 src/microhttpd/digestauth.c |  43 ++--
 src/microhttpd/internal.h   |  55 +++++
 src/microhttpd/mhd_itc.h    |  14 ++
 6 files changed, 608 insertions(+), 36 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2b010ddd..d0fa4315 100644
--- a/configure.ac
+++ b/configure.ac
@@ -961,6 +961,8 @@ AS_VAR_IF([mhd_cv_c_alignof], ["yes"],
 
 # Check system type
 AC_MSG_CHECKING([[for target host OS]])
+os_is_windows="no"
+os_is_native_w32="no"
 AS_CASE(["$host_os"],
  [*darwin* | *rhapsody* | *macosx*],
  [AC_DEFINE([OSX],[1],[This is an OS X system])
@@ -999,7 +1001,7 @@ AS_CASE(["$host_os"],
   [AC_DEFINE([CYGWIN],[1],[This is a Cygwin system])
      mhd_host_os='Windows/Cygwin'
      AC_MSG_RESULT([[$mhd_host_os]])
-     os_is_windows=yes],
+     os_is_windows="yes"],
   [*mingw*],
   [
     AC_DEFINE([MINGW],[1],[This is a MinGW system])
@@ -1016,8 +1018,8 @@ AS_CASE(["$host_os"],
      AS_IF([test "x$ac_cv_use_ms_lib_tool" = "xyes"],
        [AC_SUBST([MS_LIB_TOOL], [[lib]])])
      AC_SUBST([lt_cv_objdir])
-     os_is_windows=yes
-     os_is_native_w32=yes
+     os_is_windows="yes"
+     os_is_native_w32="yes"
    ],
    [*openedition*],
    [AC_DEFINE([OS390],[1],[This is a OS/390 system])
@@ -1623,6 +1625,501 @@ MHD_FIND_LIB([socket],
 MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([AC_DEFINE([HAVE_LISTEN_SHUTDOWN],[1],[can 
use shutdown on listen sockets])])
 AM_CONDITIONAL([HAVE_LISTEN_SHUTDOWN], [test 
"x$mhd_cv_host_shtdwn_trgr_select" = "xyes"])
 
+AC_CACHE_CHECK([fo][r system default FD_SETSIZE 
value],[mhd_cv_sys_fd_setsize_value],
+  [
+    CFLAGS="${CFLAGS_ac} ${user_CFLAGS} -UFD_SETSIZE"
+    CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS} -UFD_SETSIZE"
+    AC_COMPUTE_INT([mhd_cv_sys_fd_setsize_value],[FD_SETSIZE],dnl
+      [[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+      ]], [mhd_cv_sys_fd_setsize_value="unknown"]
+    )
+    CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
+    CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+    AS_IF([test "x${mhd_cv_sys_fd_setsize_value}" != "xunknown" && \
+      test "${mhd_cv_sys_fd_setsize_value}" -eq "0" \
+      ], [mhd_cv_sys_fd_setsize_value="unknown"]
+    )
+  ]
+)
+AS_VAR_IF([mhd_cv_sys_fd_setsize_value],["unknown"],[:],
+  [
+    AC_DEFINE_UNQUOTED([MHD_SYS_FD_SETSIZE_],[${mhd_cv_sys_fd_setsize_value}],
+      [Define to system default value of FD_SETSIZE macro]
+    )
+  ]
+)
+
+AC_CACHE_CHECK([fo][r current FD_SETSIZE value],[mhd_cv_fd_setsize_value],
+  [
+    CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
+    CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+    AS_IF([test "x${cross_compiling}" != "xno" && test 
"x${mhd_cv_sys_fd_setsize_value}" != "xunknown"],
+      [
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#define DETECTED_FD_SETZIE_VALUE ${mhd_cv_sys_fd_setsize_value}
+
+#if (FD_SETSIZE) != (DETECTED_FD_SETZIE_VALUE)
+#error The current default FD_SETSIZE value is different from 
${mhd_cv_sys_fd_setsize_value}
+choke me here now
+#endif /* (FD_SETSIZE) != (DETECTED_FD_SETZIE_VALUE) */
+
+#if (FD_SETSIZE) != (${mhd_cv_sys_fd_setsize_value})
+#error The current default FD_SETSIZE value is different from 
${mhd_cv_sys_fd_setsize_value}
+choke me here now
+#endif /* (FD_SETSIZE) != (${mhd_cv_sys_fd_setsize_value}) */
+              ]],[]
+            )
+          ],
+          [mhd_cv_fd_setsize_value="${mhd_cv_sys_fd_setsize_value}"]
+        )
+      ]
+    )
+    AS_VAR_SET_IF([mhd_cv_fd_setsize_value],[:],
+      [
+        AC_COMPUTE_INT([mhd_cv_fd_setsize_value],[FD_SETSIZE],dnl
+          [[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+          ]], [mhd_cv_fd_setsize_value="unknown"]
+        )
+      ]
+    )
+    AS_IF([test "x${mhd_cv_fd_setsize_value}" != "xunknown" && \
+      test "${mhd_cv_fd_setsize_value}" -eq "0"],
+      [mhd_cv_fd_setsize_value="unknown"]
+    )
+  ]
+)
+
+
+AC_CACHE_CHECK([whether FD_SETSIZE is 
overridable],[mhd_cv_fd_setsize_overridable],
+  [
+    AS_VAR_IF([mhd_cv_fd_setsize_value],["unknown"],
+      [
+        AS_VAR_IF([mhd_cv_sys_fd_setsize_value],["unknown"],
+          [
+            # Assume the most popular FD_SETSIZE value
+            base_fd_setsize=1024
+          ],
+          [base_fd_setsize="${mhd_cv_sys_fd_setsize_value}"]
+        )
+        base_min_fd_setsize="${base_fd_setsize}"
+      ],
+      [
+        AS_VAR_IF([mhd_cv_sys_fd_setsize_value],["unknown"],
+          [
+            base_fd_setsize="${mhd_cv_fd_setsize_value}"
+            base_min_fd_setsize="${base_fd_setsize}"
+          ],
+          [
+            AS_IF([test "${mhd_cv_fd_setsize_value}" -ge 
"${mhd_cv_sys_fd_setsize_value}"],
+              [
+                base_fd_setsize="${mhd_cv_fd_setsize_value}"
+                base_min_fd_setsize="${mhd_cv_sys_fd_setsize_value}"
+              ],
+              [
+                base_fd_setsize="${mhd_cv_sys_fd_setsize_value}"
+                base_min_fd_setsize="${mhd_cv_fd_setsize_value}"
+              ]
+            )
+          ]
+        )
+      ]
+    )
+    # Use two times larger FD_SETSIZE value for test
+    AS_VAR_ARITH([test_fd_setsize],[${base_fd_setsize} '+' ${base_fd_setsize}])
+    AS_IF([test "${test_fd_setsize}" -lt "128"],[test_fd_setsize=128])
+    test_type_fd_setsize="larger"
+
+    CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
+    CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+
+    _AS_ECHO_LOG([testing whether FD_SETSIZE test value (${test_fd_setsize}) 
is suitable for 'int' type])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+          [[
+            static int test_arr1[(((long long)${test_fd_setsize}) != 
((int)${test_fd_setsize})) ? -1 : 1];
+            static int test_arr2[(0 > ((int)${test_fd_setsize})) ? -1 : 1];
+            test_arr1[0] = 0;
+            test_arr2[0] = 0;
+            i][f (test_arr1[0] != test_arr2[0]) return 1;
+          ]]
+        )
+      ],[],
+      [
+        _AS_ECHO_LOG([The selected test FD_SETSIZE value (${test_fd_setsize}) 
is too large for 'int' type])
+        AS_VAR_ARITH([test_fd_setsize],[${base_min_fd_setsize} '/' '2'])
+        test_type_fd_setsize="smaller"
+      ]
+    )
+
+    _AS_ECHO_LOG([will try ${test_fd_setsize} as FD_SETSIZE value])
+
+    AS_IF([test "x${cross_compiling}" = "xno" && test 
"x${test_type_fd_setsize}" = "xlarger"],
+      [
+        _AS_ECHO_LOG([will try ${test_fd_setsize} as FD_SETSIZE value with run 
test])
+        AC_RUN_IFELSE(
+          [
+            AC_LANG_SOURCE(
+              [[
+#ifdef FD_SETSIZE
+#undef FD_SETSIZE
+#endif /* FD_SETSIZE */
+
+#define FD_SETSIZE          ${test_fd_setsize}
+#define MY_TEST_FD_SETSIZE  ${test_fd_setsize}
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#define MHD_TEST_SOCKET_TYPE SOCKET
+#else
+#define MHD_TEST_SOCKET_TYPE int
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+
+/* Test fo][r mismatch by macro check */
+#if (FD_SETSIZE) != (MY_TEST_FD_SETSIZE)
+#error System headers ignore custom FD_SETSIZE value, FD_SETSIZE is NOT 
${test_fd_setsize}
+choke me here now;
+#endif /* (FD_SETSIZE) != (MY_TEST_FD_SETSIZE) */
+
+/* Additional test fo][r mismatch by macro check */
+#if (FD_SETSIZE) != (${test_fd_setsize})
+#error System headers ignore custom FD_SETSIZE value, FD_SETSIZE is NOT 
${test_fd_setsize}
+choke me here now;
+#endif /* (FD_SETSIZE) != (${test_fd_setsize}) */
+
+static unsigned long var_fd_setsize_value = FD_SETSIZE;
+static unsigned long var_my_test_fd_setsize_value = MY_TEST_FD_SETSIZE;
+
+int main(void)
+{
+  fd_set fds_num_one_copy;
+  fd_set fds_num_three_copy;
+  fd_set test_fdsets[6];
+  int i;
+  int ret = 0;
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+  WSADATA wsa_data;
+
+  if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data))
+    return 21;
+  if (MAKEWORD(2, 2) != wsa_data.wVersion)
+  {
+    WSACleanup();
+    return 22;
+  }
+#endif /* _WIN32 && ! __CYGWIN__ */
+
+  /* Init with zeros to make sure that slack areas are equal */
+  memset(test_fdsets, 0, sizeof(test_fdsets));
+
+  /* Correctly init fd_sets */
+  for (i = 0; i < 6; ++i)
+    FD_ZERO(test_fdsets + i);
+
+  /* Make copies of zero-inited fd_sets */
+  memcpy(&fds_num_one_copy, test_fdsets + 1, sizeof(fd_set));
+  memcpy(&fds_num_three_copy, test_fdsets + 3, sizeof(fd_set));
+
+  if (var_fd_setsize_value != var_my_test_fd_setsize_value)
+  {
+    fprintf (stderr, "System headers redefined FD_SETSIZE to another value 
(%lu).\n",
+             (unsigned long) FD_SETSIZE);
+    ret = 2;
+  }
+  else
+  {
+    /* Set (almost) all FDs in test_fdset[2] */
+    for (i = 1; i < FD_SETSIZE; ++i)
+      FD_SET((MHD_TEST_SOCKET_TYPE)i, test_fdsets + 2);
+
+    if (! FD_ISSET((MHD_TEST_SOCKET_TYPE)1, test_fdsets + 2))
+    {
+      fprintf (stderr, "FD number one in original fd_set is unset, while 
should be set.\n");
+      ret |= 3;
+    }
+    if (! FD_ISSET((MHD_TEST_SOCKET_TYPE)(FD_SETSIZE - 1), test_fdsets + 2))
+    {
+      fprintf (stderr, "FD number %lu in original fd_set is unset, while 
should be set.\n",
+               (unsigned long) FD_SETSIZE);
+      ret |= 3;
+    }
+
+    if (FD_ISSET((MHD_TEST_SOCKET_TYPE)1, test_fdsets + 1))
+    {
+      fprintf (stderr, "FD number one in the first fd_set is unset, while 
should be set.\n");
+      ret |= 4;
+    }
+    if (FD_ISSET((MHD_TEST_SOCKET_TYPE)(FD_SETSIZE - 1), test_fdsets + 1))
+    {
+      fprintf (stderr, "FD number %lu in the first fd_set is unset, while 
should be set.\n",
+               (unsigned long) FD_SETSIZE);
+      ret |= 4;
+    }
+    if (0 != memcmp (&fds_num_one_copy, test_fdsets + 1, sizeof(fd_set)))
+    {
+      fprintf (stderr, "The first fd_set has been altered.\n");
+      ret |= 4;
+    }
+
+    if (FD_ISSET((MHD_TEST_SOCKET_TYPE)1, test_fdsets + 3))
+    {
+      fprintf (stderr, "FD number one in the third fd_set is unset, while 
should be set.\n");
+      ret |= 8;
+    }
+    if (FD_ISSET((MHD_TEST_SOCKET_TYPE)(FD_SETSIZE - 1), test_fdsets + 3))
+    {
+      fprintf (stderr, "FD number %lu in the third fd_set is unset, while 
should be set.\n",
+               (unsigned long) FD_SETSIZE);
+      ret |= 8;
+    }
+    if (0 != memcmp (&fds_num_three_copy, test_fdsets + 3, sizeof(fd_set)))
+    {
+      fprintf (stderr, "The third fd_set has been altered.\n");
+      ret |= 8;
+    }
+  }
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+  WSACleanup();
+#endif /* _WIN32 && ! __CYGWIN__ */
+  return ret;
+}
+              ]]
+            )
+          ],
+          [mhd_cv_fd_setsize_overridable="yes"],
+          [mhd_cv_fd_setsize_overridable="no"],
+          [[# Not used when cross-compiling ]]
+        )
+      ],
+      [
+        _AS_ECHO_LOG([will try ${test_fd_setsize} as FD_SETSIZE with simple 
compile test])
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+              [[
+#ifdef FD_SETSIZE
+#undef FD_SETSIZE
+#endif /* FD_SETSIZE */
+
+#define FD_SETSIZE          ${test_fd_setsize}
+#define MY_TEST_FD_SETSIZE  ${test_fd_setsize}
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+/* Test fo][r mismatch by macro check */
+#if (FD_SETSIZE) != (MY_TEST_FD_SETSIZE)
+#error System headers ignore custom FD_SETSIZE value, FD_SETSIZE is NOT 
${test_fd_setsize}
+choke me here now
+#endif /* (FD_SETSIZE) != (MY_TEST_FD_SETSIZE) */
+
+/* Additional test fo][r mismatch by macro check */
+#if (FD_SETSIZE) != (${test_fd_setsize})
+#error System headers ignore custom FD_SETSIZE value, FD_SETSIZE is NOT 
${test_fd_setsize}
+choke me here now
+#endif /* (FD_SETSIZE) != (${test_fd_setsize}) */
+              ]],[]
+            )
+          ],
+          [
+            _AS_ECHO_LOG([comple test succeed, will check whether another 
FD_SETSIZE value changes the size of 'fd_set'])
+
+            # Check current size of fd_set
+            _AS_ECHO_LOG([find the sizeof(fd_setsize) with current default 
(${mhd_cv_fd_setsize_value}) FD_SETSIZE value])
+            AC_COMPUTE_INT([sizeof_cur_fd_set],[sizeof(fd_set)],dnl
+              [[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+              ]], [sizeof_cur_fd_set="unknown"]
+            )
+            _AS_ECHO_LOG([the sizeof(fd_setsize) with current default 
(${mhd_cv_fd_setsize_value}) FD_SETSIZE value is ${sizeof_cur_fd_set}])
+
+            # Check the size of fd_set with redefined FD_SETSIZE
+            _AS_ECHO_LOG([find the sizeof(fd_setsize) with redefined 
(${test_fd_setsize}) FD_SETSIZE value])
+            AC_COMPUTE_INT([sizeof_mod_fd_set],[sizeof(fd_set)],dnl
+              [[
+#ifdef FD_SETSIZE
+#undef FD_SETSIZE
+#endif /* FD_SETSIZE */
+
+#define FD_SETSIZE          ${test_fd_setsize}
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+              ]], [sizeof_mod_fd_set="unknown"]
+            )
+            _AS_ECHO_LOG([the sizeof(fd_setsize) with redefined 
(${test_fd_setsize}) FD_SETSIZE value is ${sizeof_mod_fd_set}])
+            _AS_ECHO_LOG([detected sizes of 'fd_set': '${sizeof_cur_fd_set}' 
(by default), '${sizeof_mod_fd_set}' with modified FD_SETSIZE])
+            AS_IF([test "x${sizeof_cur_fd_set}" != "x${sizeof_mod_fd_set}"],
+              [mhd_cv_fd_setsize_overridable="yes"],
+              [mhd_cv_fd_setsize_overridable="no"]
+            )
+            AS_UNSET([sizeof_mod_fd_set])
+            AS_UNSET([sizeof_cur_fd_set])
+          ],
+          [mhd_cv_fd_setsize_overridable="no"]
+        )
+      ]
+    )
+    AS_UNSET([test_type_fd_setsize])
+    AS_UNSET([test_fd_setsize])
+    AS_UNSET([base_min_fd_setsize])
+    AS_UNSET([base_fd_setsize])
+  ]
+)
+
+AS_VAR_IF([mhd_cv_fd_setsize_overridable],["no"],
+  [
+    AS_VAR_IF([os_is_native_w32],["yes"],
+      [AC_MSG_ERROR([Non-overridable FD_SETSIZE detected for native W32 build. 
FD_SETSIZE is overridable on W32.])]
+    )
+    AS_IF([test "x${mhd_cv_fd_setsize_value}" != "xunknown" && test 
"x${mhd_cv_sys_fd_setsize_value}" != "xunknown" && test 
"${mhd_cv_fd_setsize_value}" -ne "${mhd_cv_sys_fd_setsize_value}"],
+      [AC_MSG_WARN([Detected non-overridable FD_SETSIZE, but the toolchain 
uses FD_SETSIZE (${mhd_cv_fd_setsize_value}) different from system default 
(${mhd_cv_sys_fd_setsize_value})])]
+    )
+  ],
+  [AC_DEFINE([HAS_FD_SETSIZE_OVERRIDABLE],[1],[Define to 1 i][f your system 
allow overriding the value of FD_SETSIZE macro])]
+)
+
+
 MHD_CHECK_FUNC([writev],
   [[#include <sys/uio.h>]],
   [[
@@ -5448,7 +5945,9 @@ AS_IF([test "x$enable_bauth" != "xyes" || \
    test "x${enable_md5}" = "xno" || \
    test "x${enable_sha256}" = "xno" || \
    test "x${enable_sha512_256}" != "xyes" || \
+   test "x${USE_THREADS}" = "xnone" || \
    test "x$enable_httpupgrade" != "xyes" || \
    test "x$enable_cookie" != "xyes" || \
    test "x$enable_postprocessor" != "xyes"],
-   [AC_MSG_NOTICE([WARNING: This will be a custom build with missing symbols. 
Do NOT use this build in a distribution. Building with these kinds of configure 
options is only for custom builds for embedded systems.])])
+   [AC_MSG_WARN([This will be a custom build with missing symbols. Do NOT use 
this build in a distribution. Building with these kinds of configure options is 
only for custom builds for embedded systems.])]
+)
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 738361dd..9fda5b6c 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1316,12 +1316,9 @@ enum MHD_FLAG
 
   /**
    * Be pedantic about the protocol (as opposed to as tolerant as
-   * possible).  Specifically, at the moment, this flag causes MHD to
-   * reject HTTP 1.1 connections without a "Host" header.  This is
-   * required by the standard, but of course in violation of the "be
-   * as liberal as possible in what you accept" norm.  It is
-   * recommended to turn this ON if you are testing clients against
-   * MHD, and OFF in production.
+   * possible).
+   * This flag is equivalent to setting 1 as #MHD_OPTION_CLIENT_DISCIPLINE_LVL
+   * value.
    * @sa #MHD_OPTION_CLIENT_DISCIPLINE_LVL
    */
   MHD_USE_PEDANTIC_CHECKS = 32,
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 09d58b8e..2c3dbe1a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -77,7 +77,7 @@
  * Default connection limit.
  */
 #ifdef MHD_POSIX_SOCKETS
-#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 4)
+#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 3 - 1 - MHD_ITC_NUM_FDS_)
 #else
 #define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 2)
 #endif
@@ -1424,10 +1424,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
     else   /* 0 < res */
     {
       urh->in_buffer_used += (size_t) res;
-      if (0 < gnutls_record_check_pending (connection->tls_session))
-      {
-        connection->tls_read_ready = true;
-      }
+      connection->tls_read_ready =
+        (0 < gnutls_record_check_pending (connection->tls_session));
     }
     if (MHD_EPOLL_STATE_ERROR ==
         ((MHD_EPOLL_STATE_ERROR | MHD_EPOLL_STATE_READ_READY) & urh->app.celi))
@@ -1593,7 +1591,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
                     (uint64_t) urh->in_buffer_used,
                     MHD_socket_strerr_ (err));
 #endif
-          /* Discard any data received form remote. */
+          /* Discard any data received from remote. */
           urh->in_buffer_used = 0;
           /* Reading from remote client is not required anymore. */
           urh->in_buffer_size = 0;
@@ -3038,11 +3036,11 @@ internal_add_connection (struct MHD_Daemon *daemon,
     if ((MHD_ITC_IS_VALID_ (daemon->itc)) &&
         (! MHD_itc_activate_ (daemon->itc, "n")))
     {
- #ifdef HAVE_MESSAGES
+#ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
                 _ ("Failed to signal new connection via inter-thread " \
                    "communication channel.\n"));
- #endif
+#endif
     }
     return MHD_YES;
   }
@@ -3856,7 +3854,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
      * but suppression failed and SIGPIPE cannot be suppressed with send(). */
     if (! daemon->sigpipe_blocked)
     {
-      MHD_socket_close_ (s);
+      (void) MHD_socket_close_ (s);
       return MHD_NO;
     }
 #endif /* MSG_NOSIGNAL */
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 12fa2f3a..69f9c227 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -1,7 +1,7 @@
 /*
      This file is part of libmicrohttpd
      Copyright (C) 2010, 2011, 2012, 2015, 2018 Daniel Pittman and Christian 
Grothoff
-     Copyright (C) 2014-2022 Evgeny Grin (Karlson2k)
+     Copyright (C) 2014-2023 Evgeny Grin (Karlson2k)
 
      This library is free software; you can redistribute it and/or
      modify it under the terms of the GNU Lesser General Public
@@ -2502,15 +2502,18 @@ is_param_equal_caseless (const struct MHD_RqDAuthParam 
*param,
  * used as one-time nonces because nonce-count is not supported in this old 
RFC.
  * Communication in this mode is very inefficient, especially if the client
  * requests several resources one-by-one as for every request new nonce must be
- * generated and client repeat all requests twice (first time to get a new
- * nonce and second time to perform an authorised request).
+ * generated and client repeat all requests twice (the first time to get a new
+ * nonce and the second time to perform an authorised request).
  *
  * @param connection the MHD connection structure
- * @param realm the realm presented to the client
- * @param username the username needs to be authenticated
- * @param password the password used in the authentication
- * @param userdigest the optional precalculated binary hash of the string
- *                   "username:realm:password"
+ * @param realm the realm for authorization of the client
+ * @param username the username to be authenticated, must be in clear text
+ *                 even if userhash is used by the client
+ * @param password the password used in the authentication,
+ *                 must be NULL if @a userdigest is not NULL
+ * @param userdigest the precalculated binary hash of the string
+ *                   "username:realm:password",
+ *                   must be NULL if @a password is not NULL
  * @param nonce_timeout the period of seconds since nonce generation, when
  *                      the nonce is recognised as valid and not stale.
  * @param max_nc the maximum allowed nc (Nonce Count) value, if client's nc
@@ -2521,7 +2524,7 @@ is_param_equal_caseless (const struct MHD_RqDAuthParam 
*param,
  * @param malgo3 digest algorithms allowed to use, fail if algorithm specified
  *               by the client is not allowed by this parameter
  * @param[out] pbuf the pointer to pointer to internally malloc'ed buffer,
- *                  to be free if not NULL upon return
+ *                  to be freed if not NULL upon return
  * @return #MHD_DAUTH_OK if authenticated,
  *         error code otherwise.
  * @ingroup authentication
@@ -2563,6 +2566,9 @@ digest_auth_check_all_inner (struct MHD_Connection 
*connection,
   size_t username_len;
   size_t realm_len;
 
+  mhd_assert ((NULL != password) || (NULL != userdigest));
+  mhd_assert (! ((NULL != userdigest) && (NULL != password)));
+
   tmp2_size = 0;
 
   params = MHD_get_rq_dauth_params_ (connection);
@@ -2834,7 +2840,7 @@ digest_auth_check_all_inner (struct MHD_Connection 
*connection,
     /*
      * First level vetting for the nonce validity: if the timestamp
      * attached to the nonce exceeds `nonce_timeout', then the nonce is
-     * invalid.
+     * stale.
      */
     if (TRIM_TO_TIMESTAMP (t - nonce_time) > (nonce_timeout * 1000))
       return MHD_DAUTH_NONCE_STALE; /* too old */
@@ -3044,15 +3050,18 @@ digest_auth_check_all_inner (struct MHD_Connection 
*connection,
  * used as one-time nonces because nonce-count is not supported in this old 
RFC.
  * Communication in this mode is very inefficient, especially if the client
  * requests several resources one-by-one as for every request new nonce must be
- * generated and client repeat all requests twice (first time to get a new
- * nonce and second time to perform an authorised request).
+ * generated and client repeat all requests twice (the first time to get a new
+ * nonce and the second time to perform an authorised request).
  *
  * @param connection the MHD connection structure
- * @param realm the realm presented to the client
- * @param username the username needs to be authenticated
- * @param password the password used in the authentication
- * @param userdigest the optional precalculated binary hash of the string
- *                   "username:realm:password"
+ * @param realm the realm for authorization of the client
+ * @param username the username to be authenticated, must be in clear text
+ *                 even if userhash is used by the client
+ * @param password the password used in the authentication,
+ *                 must be NULL if @a userdigest is not NULL
+ * @param userdigest the precalculated binary hash of the string
+ *                   "username:realm:password",
+ *                   must be NULL if @a password is not NULL
  * @param nonce_timeout the period of seconds since nonce generation, when
  *                      the nonce is recognised as valid and not stale.
  * @param max_nc the maximum allowed nc (Nonce Count) value, if client's nc
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index e9020cf9..adcc43da 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -149,6 +149,61 @@
 #endif /* ! MHD_STATICSTR_LEN_ */
 
 
+#if defined(HAVE_POLL) && defined(EPOLL_SUPPORT)
+/**
+ * Checks whether the @a d daemon is using select()
+ */
+#define MHD_D_USING_SELECT_(d) \
+  (0 == (d->options & (MHD_USE_POLL | MHD_USE_EPOLL)))
+/**
+ * Checks whether the @a d daemon is using poll()
+ */
+#define MHD_D_USING_POLL_(d) (0 != (d->options & MHD_USE_POLL))
+/**
+ * Checks whether the @a d daemon is using epoll
+ */
+#define MHD_D_USING_EPOLL_(d) (0 != (d->options & MHD_USE_EPOLL))
+#elif defined(HAVE_POLL)
+/**
+ * Checks whether the @a d daemon is using select()
+ */
+#define MHD_D_USING_SELECT_(d) (0 == (d->options & MHD_USE_POLL))
+/**
+ * Checks whether the @a d daemon is using poll()
+ */
+#define MHD_D_USING_POLL_(d) (0 != (d->options & MHD_USE_POLL))
+/**
+ * Checks whether the @a d daemon is using epoll
+ */
+#define MHD_D_USING_EPOLL_(d) (0)
+#elif defined(EPOLL_SUPPORT)
+/**
+ * Checks whether the @a d daemon is using select()
+ */
+#define MHD_D_USING_SELECT_(d) (0 == (d->options & MHD_USE_EPOLL))
+/**
+ * Checks whether the @a d daemon is using poll()
+ */
+#define MHD_D_USING_POLL_(d) (0)
+/**
+ * Checks whether the @a d daemon is using epoll
+ */
+#define MHD_D_USING_EPOLL_(d) (0 != (d->options & MHD_USE_EPOLL))
+#else  /* select() only */
+/**
+ * Checks whether the @a d daemon is using select()
+ */
+#define MHD_D_USING_SELECT_(d) (! 0)
+/**
+ * Checks whether the @a d daemon is using poll()
+ */
+#define MHD_D_USING_POLL_(d) (0)
+/**
+ * Checks whether the @a d daemon is using epoll
+ */
+#define MHD_D_USING_EPOLL_(d) (0)
+#endif /* select() only */
+
 /**
  * Tri-state on/off/unknown
  */
diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h
index 3822c164..780a6c53 100644
--- a/src/microhttpd/mhd_itc.h
+++ b/src/microhttpd/mhd_itc.h
@@ -61,6 +61,10 @@
 #include <errno.h>
 #endif
 
+/**
+ * Number of FDs used by every ITC.
+ */
+#define MHD_ITC_NUM_FDS_ (1)
 
 /**
  * Initialise ITC by generating eventFD
@@ -155,6 +159,11 @@ static const uint64_t _MHD_itc_wr_data = 1;
 #endif
 
 
+/**
+ * Number of FDs used by every ITC.
+ */
+#define MHD_ITC_NUM_FDS_ (2)
+
 /**
  * Initialise ITC by generating pipe
  * @param itc the itc to initialise
@@ -256,6 +265,11 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc);
 #include "mhd_sockets.h"
 
 
+/**
+ * Number of FDs used by every ITC.
+ */
+#define MHD_ITC_NUM_FDS_ (2)
+
 /**
  * Initialise ITC by generating socketpair
  * @param itc the itc to initialise

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