gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 07/08: Added MHD_OPTION_APP_FD_SETSIZE and MHD_FEATURE_F


From: gnunet
Subject: [libmicrohttpd] 07/08: Added MHD_OPTION_APP_FD_SETSIZE and MHD_FEATURE_FLEXIBLE_FD_SETSIZE
Date: Tue, 07 Nov 2023 18:52:16 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 89c1076aac6e187028ba2f27a43ae1f4393e0e5a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Nov 7 12:47:08 2023 +0300

    Added MHD_OPTION_APP_FD_SETSIZE and MHD_FEATURE_FLEXIBLE_FD_SETSIZE
    
    This should provide better compatibility with platforms with ability
    to override FD_SETSIZE.
    The new option is used examples and tests.
---
 doc/examples/sessions.c                           |   1 +
 src/examples/fileserver_example_external_select.c |   4 +-
 src/examples/post_example.c                       |   1 +
 src/include/microhttpd.h                          |  37 +++++-
 src/microhttpd/daemon.c                           | 153 ++++++++++++++++++++--
 src/microhttpd/internal.h                         |  34 +++++
 src/microhttpd/response.c                         |  12 +-
 src/microhttpd/test_client_put_stop.c             |  16 ++-
 src/microhttpd/test_daemon.c                      |   1 +
 src/microhttpd/test_set_panic.c                   |  13 +-
 src/testcurl/perf_get.c                           |   1 +
 src/testcurl/perf_get_concurrent.c                |   4 +-
 src/testcurl/test_add_conn.c                      |  13 +-
 src/testcurl/test_basicauth.c                     |   1 +
 src/testcurl/test_callback.c                      |   1 +
 src/testcurl/test_delete.c                        |   4 +-
 src/testcurl/test_digestauth2.c                   |   1 +
 src/testcurl/test_digestauth_emu_ext.c            |   1 +
 src/testcurl/test_get.c                           |   1 +
 src/testcurl/test_get_chunked.c                   |   4 +-
 src/testcurl/test_get_close_keep_alive.c          |  10 +-
 src/testcurl/test_get_empty.c                     |   1 +
 src/testcurl/test_get_iovec.c                     |   4 +-
 src/testcurl/test_get_response_cleanup.c          |   4 +-
 src/testcurl/test_get_sendfile.c                  |   4 +-
 src/testcurl/test_head.c                          |   1 +
 src/testcurl/test_large_put.c                     |   1 +
 src/testcurl/test_parse_cookies.c                 |   1 +
 src/testcurl/test_patch.c                         |   4 +-
 src/testcurl/test_post.c                          |   1 +
 src/testcurl/test_post_loop.c                     |   4 +-
 src/testcurl/test_postform.c                      |   1 +
 src/testcurl/test_process_arguments.c             |   4 +-
 src/testcurl/test_process_headers.c               |   4 +-
 src/testcurl/test_put.c                           |   4 +-
 src/testcurl/test_put_broken_len.c                |   1 +
 src/testcurl/test_put_chunked.c                   |   4 +-
 src/testcurl/test_put_header_fold.c               |   1 +
 src/testcurl/test_quiesce.c                       |   2 +
 src/testcurl/test_toolarge.c                      |  13 +-
 src/testcurl/test_tricky.c                        |  11 +-
 src/testzzuf/test_get.c                           |  21 ++-
 42 files changed, 361 insertions(+), 43 deletions(-)

diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 2f3e6fe5..958a775f 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -761,6 +761,7 @@ main (int argc, char *const *argv)
                         MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
                         MHD_OPTION_NOTIFY_COMPLETED,
                         &request_completed_callback, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (NULL == d)
     return 1;
diff --git a/src/examples/fileserver_example_external_select.c 
b/src/examples/fileserver_example_external_select.c
index 87097529..e08a301e 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -163,7 +163,9 @@ main (int argc, char *const *argv)
 
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         (uint16_t) port,
-                        NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 1;
   end = time (NULL) + atoi (argv[2]);
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index f6823e38..2edf1f99 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -782,6 +782,7 @@ main (int argc, char *const *argv)
                         MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
                         MHD_OPTION_NOTIFY_COMPLETED,
                         &request_completed_callback, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (NULL == d)
     return 1;
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 9fda5b6c..221d24fc 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097704
+#define MHD_VERSION 0x00097705
 
 /* If generic headers don't work on your platform, include headers
    which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t',
@@ -2118,7 +2118,29 @@ enum MHD_OPTION
    * This option should be followed by an `int` argument.
    * @note Available since #MHD_VERSION 0x00097701
    */
-  MHD_OPTION_CLIENT_DISCIPLINE_LVL = 38
+  MHD_OPTION_CLIENT_DISCIPLINE_LVL = 38,
+
+  /**
+   * Specifies value of FD_SETSIZE used by application.  Only For external
+   * polling modes (without MHD internal threads).
+   * Some platforms (FreeBSD, Solaris, W32 etc.) allow overriding of FD_SETSIZE
+   * value.  When polling by select() is used, MHD rejects sockets with numbers
+   * equal or higher than FD_SETSIZE.  If this option is used, MHD treats this
+   * value as a limitation for socket number instead of FD_SETSIZE value which
+   * was used for building MHD.
+   * When external polling is used with #MHD_get_fdset2() (or #MHD_get_fdset()
+   * macro) and #MHD_run_from_select() interfaces, it is recommended to always
+   * use this option.
+   * It is safe to use this option on platforms with fixed FD_SETSIZE (like
+   * GNU/Linux) if system value of FD_SETSIZE is used as the argument.
+   * Can be used only for daemons without #MHD_USE_INTERNAL_POLLING_THREAD, 
i.e.
+   * only when external sockets polling is used.
+   * On W32 it is silently ignored, as W32 does not limit the socket number in
+   * fd_sets.
+   * This option should be followed by a positive 'int' argument.
+   * @note Available since #MHD_VERSION 0x00097705
+   */
+  MHD_OPTION_APP_FD_SETSIZE = 39
 
 } _MHD_FIXED_ENUM;
 
@@ -6339,7 +6361,16 @@ enum MHD_FEATURE
    * is not specified for daemon.
    * @note Available since #MHD_VERSION 0x00097701
    */
-  MHD_FEATURE_DEBUG_BUILD = 33
+  MHD_FEATURE_DEBUG_BUILD = 33,
+
+  /**
+   * Get whether MHD was build with support for overridable FD_SETSIZE.
+   * This feature should be always available when the relevant platform ability
+   * is detected.
+   * @sa #MHD_OPTION_APP_FD_SETSIZE
+   * @note Available since #MHD_VERSION 0x00097705
+   */
+  MHD_FEATURE_FLEXIBLE_FD_SETSIZE = 34
 };
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index ac21a3be..d006f605 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2980,14 +2980,14 @@ internal_add_connection (struct MHD_Daemon *daemon,
 #endif
 
   if (MHD_D_IS_USING_SELECT_ (daemon) &&
-      (! MHD_SCKT_FD_FITS_FDSET_ (client_socket, NULL)) )
+      (! MHD_D_DOES_SCKT_FIT_FDSET_ (client_socket, NULL, daemon)) )
   {
 #ifdef HAVE_MESSAGES
     MHD_DLOG (daemon,
               _ ("New connection socket descriptor (%d) is not less " \
                  "than FD_SETSIZE (%d).\n"),
               (int) client_socket,
-              (int) FD_SETSIZE);
+              (int) MHD_D_GET_FD_SETSIZE_ (daemon));
 #endif
     MHD_socket_close_chk_ (client_socket);
 #if defined(ENFILE) && (ENFILE + 0 != 0)
@@ -5921,6 +5921,23 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
 }
 
 
+/**
+ * Temporal location of the application-provided parameters/options.
+ * Used when options are decoded from #MHD_start_deamon() parameters, but
+ * not yet processed/applied.
+ */
+struct MHD_InterimParams_
+{
+  /**
+   * Set to 'true' if @a fdset_size is set by application.
+   */
+  bool fdset_size_set;
+  /**
+   * The value for #MHD_OPTION_APP_FD_SETSIZE set by application.
+   */
+  int fdset_size;
+};
+
 /**
  * Signature of the MHD custom logger function.
  *
@@ -5939,12 +5956,14 @@ typedef void
  *
  * @param daemon the daemon to initialize
  * @param servaddr where to store the server's listen address
+ * @param params the interim parameters to be assigned to
  * @param ap the options
  * @return #MHD_YES on success, #MHD_NO on error
  */
 static enum MHD_Result
 parse_options_va (struct MHD_Daemon *daemon,
                   const struct sockaddr **servaddr,
+                  struct MHD_InterimParams_ *params,
                   va_list ap);
 
 
@@ -5953,20 +5972,23 @@ parse_options_va (struct MHD_Daemon *daemon,
  *
  * @param daemon the daemon to initialize
  * @param servaddr where to store the server's listen address
+ * @param params the interim parameters to be assigned to
  * @param ... the options
  * @return #MHD_YES on success, #MHD_NO on error
  */
 static enum MHD_Result
 parse_options (struct MHD_Daemon *daemon,
                const struct sockaddr **servaddr,
+               struct MHD_InterimParams_ *params,
                ...)
 {
   va_list ap;
   enum MHD_Result ret;
 
-  va_start (ap, servaddr);
+  va_start (ap, params);
   ret = parse_options_va (daemon,
                           servaddr,
+                          params,
                           ap);
   va_end (ap);
   return ret;
@@ -6241,12 +6263,14 @@ daemon_tls_priorities_init_append (struct MHD_Daemon 
*daemon, const char *prio)
  *
  * @param daemon the daemon to initialize
  * @param servaddr where to store the server's listen address
+ * @param params the interim parameters to be assigned to
  * @param ap the options
  * @return #MHD_YES on success, #MHD_NO on error
  */
 static enum MHD_Result
 parse_options_va (struct MHD_Daemon *daemon,
                   const struct sockaddr **servaddr,
+                  struct MHD_InterimParams_ *params,
                   va_list ap)
 {
   enum MHD_OPTION opt;
@@ -6767,6 +6791,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_THREAD_STACK_SIZE:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (size_t) oa[i].value,
                                        MHD_OPTION_END))
@@ -6785,6 +6810,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_DIGEST_AUTH_NONCE_BIND_TYPE:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (unsigned int) oa[i].value,
                                        MHD_OPTION_END))
@@ -6795,6 +6821,7 @@ parse_options_va (struct MHD_Daemon *daemon,
 #ifdef HTTPS_SUPPORT
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (gnutls_credentials_type_t) oa[i].value,
                                        MHD_OPTION_END))
@@ -6805,6 +6832,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_LISTEN_SOCKET:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (MHD_socket) oa[i].value,
                                        MHD_OPTION_END))
@@ -6815,8 +6843,10 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_CLIENT_DISCIPLINE_LVL:
         case MHD_OPTION_SIGPIPE_HANDLED_BY_APP:
         case MHD_OPTION_TLS_NO_ALPN:
+        case MHD_OPTION_APP_FD_SETSIZE:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (int) oa[i].value,
                                        MHD_OPTION_END))
@@ -6836,6 +6866,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_HTTPS_CERT_CALLBACK2:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        oa[i].ptr_value,
                                        MHD_OPTION_END))
@@ -6850,6 +6881,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_GNUTLS_PSK_CRED_HANDLER:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (void *) oa[i].value,
                                        oa[i].ptr_value,
@@ -6861,6 +6893,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         case MHD_OPTION_DIGEST_AUTH_RANDOM_COPY:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
+                                       params,
                                        opt,
                                        (size_t) oa[i].value,
                                        oa[i].ptr_value,
@@ -6921,6 +6954,11 @@ parse_options_va (struct MHD_Daemon *daemon,
                   (int) opt);
 #endif /* HAVE_MESSAGES */
       break;
+    case MHD_OPTION_APP_FD_SETSIZE:
+      params->fdset_size_set = true;
+      params->fdset_size = va_arg (ap,
+                                   int);
+      break;
 #ifndef HTTPS_SUPPORT
     case MHD_OPTION_HTTPS_MEM_KEY:
     case MHD_OPTION_HTTPS_MEM_CERT:
@@ -7066,6 +7104,63 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
 
 #endif
 
+
+/**
+ * Apply interim parameters
+ * @param d the daemon to use
+ * @param params the interim parameters to process
+ * @return true in case of success,
+ *         false in case of critical error (the daemon must be closed).
+ */
+static bool
+process_interim_params (struct MHD_Daemon *d,
+                        struct MHD_InterimParams_ *params)
+{
+  if (params->fdset_size_set)
+  {
+    if (0 >= params->fdset_size)
+    {
+#ifdef HAVE_MESSAGES
+      MHD_DLOG (d,
+                _ ("MHD_OPTION_APP_FD_SETSIZE value (%d) is not positive.\n"),
+                params->fdset_size);
+#endif /* HAVE_MESSAGES */
+      return false;
+    }
+    if (MHD_D_IS_USING_THREADS_ (d))
+    {
+#ifdef HAVE_MESSAGES
+      MHD_DLOG (d,
+                _ ("MHD_OPTION_APP_FD_SETSIZE is ignored for daemon started " \
+                   "with MHD_USE_INTERNAL_POLLING_THREAD.\n"));
+#endif /* HAVE_MESSAGES */
+    }
+    else
+    { /* The daemon without internal threads, external sockets polling */
+#ifdef MHD_POSIX_SOCKETS
+#ifndef HAS_FD_SETSIZE_OVERRIDABLE
+      if (((int) FD_SETSIZE) != params->fdset_size)
+      {
+#ifdef HAVE_MESSAGES
+        MHD_DLOG (d,
+                  _ ("MHD_OPTION_APP_FD_SETSIZE value (%d) does not match " \
+                     "the platform FD_SETSIZE value (%d) and this platform " \
+                     "does not support overriding of FD_SETSIZE.\n"),
+                  params->fdset_size, (int) FD_SETSIZE);
+#endif /* HAVE_MESSAGES */
+        return false;
+      }
+#else  /* HAS_FD_SETSIZE_OVERRIDABLE */
+      d->fdset_size = params->fdset_size;
+      d->fdset_size_set_by_app = true;
+#endif /* HAS_FD_SETSIZE_OVERRIDABLE */
+#endif /* MHD_POSIX_SOCKETS */
+    }
+  }
+  return true;
+}
+
+
 /**
  * Start a webserver on the given port.
  *
@@ -7110,6 +7205,7 @@ MHD_start_daemon_va (unsigned int flags,
 #endif
   enum MHD_FLAG eflags; /* same type as in MHD_Daemon */
   enum MHD_FLAG *pflags;
+  struct MHD_InterimParams_ *interim_params;
 
   MHD_check_global_init_ ();
   eflags = (enum MHD_FLAG) flags;
@@ -7179,6 +7275,15 @@ MHD_start_daemon_va (unsigned int flags,
 
   if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon))))
     return NULL;
+  interim_params = (struct MHD_InterimParams_ *) \
+                   MHD_calloc_ (1, sizeof (struct MHD_InterimParams_));
+  if (NULL == interim_params)
+  {
+    int err_num = errno;
+    free (daemon);
+    errno = err_num;
+    return NULL;
+  }
 #ifdef EPOLL_SUPPORT
   daemon->epoll_fd = -1;
 #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
@@ -7229,6 +7334,10 @@ MHD_start_daemon_va (unsigned int flags,
 #if defined(_DEBUG) && defined(HAVE_ACCEPT4)
   daemon->avoid_accept4 = false;
 #endif /* _DEBUG */
+#ifdef HAS_FD_SETSIZE_OVERRIDABLE
+  daemon->fdset_size = (int) FD_SETSIZE;
+  daemon->fdset_size_set_by_app = false;
+#endif /* HAS_FD_SETSIZE_OVERRIDABLE */
 
   if ( (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) &&
        (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) )
@@ -7257,9 +7366,12 @@ MHD_start_daemon_va (unsigned int flags,
   }
 #endif /* HTTPS_SUPPORT */
 
+  interim_params->fdset_size_set = false;
+  interim_params->fdset_size = 0;
 
   if (MHD_NO == parse_options_va (daemon,
                                   &servaddr,
+                                  interim_params,
                                   ap))
   {
 #ifdef HTTPS_SUPPORT
@@ -7267,9 +7379,18 @@ MHD_start_daemon_va (unsigned int flags,
          (NULL != daemon->priority_cache) )
       gnutls_priority_deinit (daemon->priority_cache);
 #endif /* HTTPS_SUPPORT */
+    free (interim_params);
+    free (daemon);
+    return NULL;
+  }
+  if (! process_interim_params (daemon, interim_params))
+  {
+    free (interim_params);
     free (daemon);
     return NULL;
   }
+  free (interim_params);
+  interim_params = NULL;
 #ifdef HTTPS_SUPPORT
   if ((0 != (*pflags & MHD_USE_TLS))
       && (NULL == daemon->priority_cache)
@@ -7330,8 +7451,8 @@ MHD_start_daemon_va (unsigned int flags,
       return NULL;
     }
     if (MHD_D_IS_USING_SELECT_ (daemon) &&
-        (! MHD_SCKT_FD_FITS_FDSET_ (MHD_itc_r_fd_ (daemon->itc),
-                                    NULL)) )
+        (! MHD_D_DOES_SCKT_FIT_FDSET_ (MHD_itc_r_fd_ (daemon->itc), \
+                                       NULL, daemon)) )
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
@@ -7791,16 +7912,17 @@ MHD_start_daemon_va (unsigned int flags,
     }
     else
       daemon->listen_nonblk = true;
-    if ( (! MHD_SCKT_FD_FITS_FDSET_ (listen_fd,
-                                     NULL)) &&
-         MHD_D_IS_USING_SELECT_ (daemon) )
+    if (MHD_D_IS_USING_SELECT_ (daemon) &&
+        (! MHD_D_DOES_SCKT_FIT_FDSET_ (listen_fd, \
+                                       NULL, \
+                                       daemon)) )
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
                 _ ("Listen socket descriptor (%d) is not " \
-                   "less than FD_SETSIZE (%d).\n"),
+                   "less than daemon FD_SETSIZE value (%d).\n"),
                 (int) listen_fd,
-                (int) FD_SETSIZE);
+                (int) MHD_D_GET_FD_SETSIZE_ (daemon));
 #endif
       MHD_socket_close_chk_ (listen_fd);
       goto free_and_fail;
@@ -7994,8 +8116,9 @@ MHD_start_daemon_va (unsigned int flags,
             goto thread_failed;
           }
           if (MHD_D_IS_USING_SELECT_ (d) &&
-              (! MHD_SCKT_FD_FITS_FDSET_ (MHD_itc_r_fd_ (d->itc),
-                                          NULL)) )
+              (! MHD_D_DOES_SCKT_FIT_FDSET_ (MHD_itc_r_fd_ (d->itc), \
+                                             NULL, \
+                                             daemon)) )
           {
 #ifdef HAVE_MESSAGES
             MHD_DLOG (daemon,
@@ -8924,6 +9047,12 @@ MHD_is_feature_supported (enum MHD_FEATURE feature)
 #else
     return MHD_NO;
 #endif
+  case MHD_FEATURE_FLEXIBLE_FD_SETSIZE:
+#ifdef HAS_FD_SETSIZE_OVERRIDABLE
+    return MHD_YES;
+#else  /* ! HAS_FD_SETSIZE_OVERRIDABLE */
+    return MHD_NO;
+#endif /* ! HAS_FD_SETSIZE_OVERRIDABLE */
 
   default:
     break;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 0f8669f4..eb87c8e6 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -2264,6 +2264,22 @@ struct MHD_Daemon
    */
   int client_discipline;
 
+#ifdef HAS_FD_SETSIZE_OVERRIDABLE
+  /**
+   * The value of FD_SETSIZE used by the daemon.
+   * For external sockets polling this is the value provided by the application
+   * via MHD_OPTION_APP_FD_SETSIZE or current FD_SETSIZE value.
+   * For internal threads modes this is always current FD_SETSIZE value.
+   */
+  int fdset_size;
+
+  /**
+   * Indicates whether @a fdset_size value was set by application.
+   * 'false' if default value is used.
+   */
+  bool fdset_size_set_by_app;
+#endif /* HAS_FD_SETSIZE_OVERRIDABLE */
+
   /**
    * True if SIGPIPE is blocked
    */
@@ -2555,6 +2571,24 @@ struct MHD_Daemon
 #define MHD_D_IS_USING_THREAD_PER_CONN_(d) ((void) d, 0)
 #endif /* ! MHD_USE_THREADS */
 
+#ifdef HAS_FD_SETSIZE_OVERRIDABLE
+/**
+ * Get FD_SETSIZE used by the daemon @a d
+ */
+#define MHD_D_GET_FD_SETSIZE_(d) ((d)->fdset_size)
+#else  /* ! HAS_FD_SETSIZE_OVERRIDABLE */
+/**
+ * Get FD_SETSIZE used by the daemon @a d
+ */
+#define MHD_D_GET_FD_SETSIZE_(d) (FD_SETSIZE)
+#endif /* ! HAS_FD_SETSIZE_OVERRIDABLE */
+
+/**
+ * Check whether socket @a sckt fits fd_sets used by the daemon @a d
+ */
+#define MHD_D_DOES_SCKT_FIT_FDSET_(sckt,pset,d) \
+  MHD_SCKT_FD_FITS_FDSET_SETSIZE_(sckt,pset,MHD_D_GET_FD_SETSIZE_(d))
+
 
 #ifdef DAUTH_SUPPORT
 
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index caf7bd18..d592007d 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -2021,15 +2021,17 @@ MHD_response_execute_upgrade_ (struct MHD_Response 
*response,
 #endif /* ! MSG_NOSIGNAL */
     }
 #endif /* MHD_socket_nosignal_ */
-    if ( (! MHD_SCKT_FD_FITS_FDSET_ (sv[1],
-                                     NULL)) &&
-         MHD_D_IS_USING_SELECT_ (daemon) )
+    if (MHD_D_IS_USING_SELECT_ (daemon) &&
+        (! MHD_D_DOES_SCKT_FIT_FDSET_ (sv[1], \
+                                       NULL, \
+                                       daemon)) )
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
-                _ ("Socketpair descriptor larger than FD_SETSIZE: %d > %d\n"),
+                _ ("Socketpair descriptor is not less than FD_SETSIZE: " \
+                   "%d >= %d\n"),
                 (int) sv[1],
-                (int) FD_SETSIZE);
+                (int) MHD_D_GET_FD_SETSIZE_ (daemon));
 #endif
       MHD_socket_close_chk_ (sv[0]);
       MHD_socket_close_chk_ (sv[1]);
diff --git a/src/microhttpd/test_client_put_stop.c 
b/src/microhttpd/test_client_put_stop.c
index 4794070e..388bc12d 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -1977,7 +1977,21 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       *pport += 1 << 4;
   }
 
-  if (testMhdThreadInternalPool != thrType)
+  if (testMhdThreadExternal == thrType)
+    d = MHD_start_daemon (((unsigned int) pollType)
+                          | (verbose ? MHD_USE_ERROR_LOG : 0),
+                          *pport, NULL, NULL,
+                          &ahcCheck, *ahc_param,
+                          MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb,
+                          *uri_cb_param,
+                          MHD_OPTION_NOTIFY_COMPLETED, &term_cb, *term_result,
+                          MHD_OPTION_NOTIFY_CONNECTION, &socket_cb,
+                          *sckt_result,
+                          MHD_OPTION_CONNECTION_TIMEOUT,
+                          (unsigned) TIMEOUTS_VAL,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                          MHD_OPTION_END);
+  else if (testMhdThreadInternalPool != thrType)
     d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c
index 6990ea3a..b759bc98 100644
--- a/src/microhttpd/test_daemon.c
+++ b/src/microhttpd/test_daemon.c
@@ -125,6 +125,7 @@ testExternalRun (void)
                         0,
                         &apc_all, NULL,
                         &ahc_nothing, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
 
   if (NULL == d)
diff --git a/src/microhttpd/test_set_panic.c b/src/microhttpd/test_set_panic.c
index 44df5707..cec361f6 100644
--- a/src/microhttpd/test_set_panic.c
+++ b/src/microhttpd/test_set_panic.c
@@ -1467,7 +1467,18 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
 
   MHD_set_panic_func (&myPanicCallback, (void *) &magic_panic_param);
 
-  if (testMhdThreadInternalPool != thrType)
+  if (testMhdThreadExternal == thrType)
+    d = MHD_start_daemon (((unsigned int) pollType)
+                          | (verbose ? MHD_USE_ERROR_LOG : 0),
+                          *pport, NULL, NULL,
+                          &ahcCheck, *ahc_param,
+                          MHD_OPTION_NOTIFY_CONNECTION, &socket_cb,
+                          NULL,
+                          MHD_OPTION_CONNECTION_TIMEOUT,
+                          (unsigned) TIMEOUTS_VAL,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                          MHD_OPTION_END);
+  else if (testMhdThreadInternalPool != thrType)
     d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 1f009660..0a8af562 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -461,6 +461,7 @@ testExternalGet (uint16_t port)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
                         &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (NULL == d)
     return 256;
diff --git a/src/testcurl/perf_get_concurrent.c 
b/src/testcurl/perf_get_concurrent.c
index a0cf4c6a..f4728ff4 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -421,7 +421,9 @@ testExternalGet (uint16_t port)
 
   signal_done = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c
index 5cc91a9b..4fd651b3 100644
--- a/src/testcurl/test_add_conn.c
+++ b/src/testcurl/test_add_conn.c
@@ -737,7 +737,18 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       *pport += 4;
   }
 
-  if (testMhdThreadInternalPool != thrType)
+  if (testMhdThreadExternal == thrType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
+                          | (thrType == testMhdThreadExternal ?
+                             0 : MHD_USE_ITC)
+                          | (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0)
+                          | MHD_USE_ERROR_LOG,
+                          *pport, NULL, NULL,
+                          &ahc_echo, NULL,
+                          MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                          MHD_OPTION_END);
+  else if (testMhdThreadInternalPool != thrType)
     d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (thrType == testMhdThreadExternal ?
                              0 : MHD_USE_ITC)
diff --git a/src/testcurl/test_basicauth.c b/src/testcurl/test_basicauth.c
index 732c1ec1..963639c9 100644
--- a/src/testcurl/test_basicauth.c
+++ b/src/testcurl/test_basicauth.c
@@ -650,6 +650,7 @@ testBasicAuth (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
                         &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 1;
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index a64c6e2e..510043cc 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -147,6 +147,7 @@ main (int argc, char **argv)
                         NULL,
                         &callback,
                         NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 32;
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index adf68592..681afe30 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -391,7 +391,9 @@ testExternalDelete (void)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port,
-                        NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+                        NULL, NULL, &ahc_echo, &done_flag,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_digestauth2.c b/src/testcurl/test_digestauth2.c
index 62a4d4a2..ce2def62 100644
--- a/src/testcurl/test_digestauth2.c
+++ b/src/testcurl/test_digestauth2.c
@@ -1374,6 +1374,7 @@ testDigestAuth (void)
                           MHD_OPTION_NONCE_NC_SIZE, 300,
                           MHD_OPTION_DIGEST_AUTH_NONCE_BIND_TYPE,
                           dauth_nonce_bind,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                           MHD_OPTION_END);
   }
   if (d == NULL)
diff --git a/src/testcurl/test_digestauth_emu_ext.c 
b/src/testcurl/test_digestauth_emu_ext.c
index d5e79eb3..7a6e8e7b 100644
--- a/src/testcurl/test_digestauth_emu_ext.c
+++ b/src/testcurl/test_digestauth_emu_ext.c
@@ -823,6 +823,7 @@ testDigestAuthEmu (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
                         &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 1;
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index ad794ef7..b44c8370 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -428,6 +428,7 @@ testExternalGet (void)
                         global_port, NULL, NULL,
                         &ahc_echo, NULL,
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 256;
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index ebba7110..1b985ce2 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -592,7 +592,9 @@ testExternalGet (void)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_get_close_keep_alive.c 
b/src/testcurl/test_get_close_keep_alive.c
index 21f909c6..5771bec9 100644
--- a/src/testcurl/test_get_close_keep_alive.c
+++ b/src/testcurl/test_get_close_keep_alive.c
@@ -956,7 +956,15 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       *pport += 2;
   }
 
-  if (testMhdThreadInternalPool != thrType)
+  if (testMhdThreadExternal == thrType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
+                          | MHD_USE_ERROR_LOG,
+                          *pport, NULL, NULL,
+                          &ahc_echo, NULL,
+                          MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                          MHD_OPTION_END);
+  else if (testMhdThreadInternalPool != thrType)
     d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | MHD_USE_ERROR_LOG,
                           *pport, NULL, NULL,
diff --git a/src/testcurl/test_get_empty.c b/src/testcurl/test_get_empty.c
index cc34d152..3ec28c3f 100644
--- a/src/testcurl/test_get_empty.c
+++ b/src/testcurl/test_get_empty.c
@@ -390,6 +390,7 @@ testExternalGet ()
                         global_port, NULL, NULL,
                         &ahc_echo, "GET",
                         MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 256;
diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c
index daaa7840..00e4fa3e 100644
--- a/src/testcurl/test_get_iovec.c
+++ b/src/testcurl/test_get_iovec.c
@@ -517,7 +517,9 @@ testExternalGet (void)
   cbc.size = sizeof(readbuf);
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_cont, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_cont, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_get_response_cleanup.c 
b/src/testcurl/test_get_response_cleanup.c
index 8307dc42..29cbc8bd 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -339,7 +339,9 @@ testExternalGet (void)
 
   ok = 1;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index 893d252b..698a7c2e 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -374,7 +374,9 @@ testExternalGet (void)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_head.c b/src/testcurl/test_head.c
index f8e1fccc..4f820880 100644
--- a/src/testcurl/test_head.c
+++ b/src/testcurl/test_head.c
@@ -759,6 +759,7 @@ testHead (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
                         &ahcCheck, &ahc_param,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 1;
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index e478056b..d2612fa8 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -652,6 +652,7 @@ testPutExternal (void)
                         NULL, NULL, &ahc_echo, &done_flag,
                         MHD_OPTION_CONNECTION_MEMORY_LIMIT,
                         (size_t) (incr_read ? 1024 : (PUT_SIZE * 4)),
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     mhdErrorExit ();
diff --git a/src/testcurl/test_parse_cookies.c 
b/src/testcurl/test_parse_cookies.c
index b2f1d318..d81f0765 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -1651,6 +1651,7 @@ testExternalPolling (void)
                         &ahcCheck, &ahc_param,
                         MHD_OPTION_CLIENT_DISCIPLINE_LVL,
                         (int) (discp_level),
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 1;
diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c
index 95839f39..e5f37901 100644
--- a/src/testcurl/test_patch.c
+++ b/src/testcurl/test_patch.c
@@ -376,7 +376,9 @@ testExternalPut (void)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port,
-                        NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+                        NULL, NULL, &ahc_echo, &done_flag,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index 8dedcc17..3f64c0a4 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -436,6 +436,7 @@ testExternalPost (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 256;
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index 879d0266..7144abdd 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -432,7 +432,9 @@ testExternalPost (void)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index 7534b6b7..bbd0d137 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -560,6 +560,7 @@ testExternalPost (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 256;
diff --git a/src/testcurl/test_process_arguments.c 
b/src/testcurl/test_process_arguments.c
index 358b42f4..f9720b89 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -150,7 +150,9 @@ testExternalGet (void)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_process_headers.c 
b/src/testcurl/test_process_headers.c
index 8a20d885..ce30b8a9 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -407,7 +407,9 @@ testExternalGet (void)
   cbc.size = 2048;
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
-                        port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
+                        port, NULL, NULL, &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 03881040..97ed8591 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -400,7 +400,9 @@ testExternalPut (void)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port,
-                        NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+                        NULL, NULL, &ahc_echo, &done_flag,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_put_broken_len.c 
b/src/testcurl/test_put_broken_len.c
index f1090b92..65e8cd82 100644
--- a/src/testcurl/test_put_broken_len.c
+++ b/src/testcurl/test_put_broken_len.c
@@ -631,6 +631,7 @@ performTest (void)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port, NULL, NULL,
                         &ahcCheck, &ahc_param,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     return 1;
diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c
index 6d55aa27..403614ce 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -398,7 +398,9 @@ testExternalPut (void)
   cbc.pos = 0;
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         port,
-                        NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
+                        NULL, NULL, &ahc_echo, &done_flag,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                        MHD_OPTION_END);
   if (d == NULL)
     return 256;
   if (0 == port)
diff --git a/src/testcurl/test_put_header_fold.c 
b/src/testcurl/test_put_header_fold.c
index c6a78b65..9b77ed99 100644
--- a/src/testcurl/test_put_header_fold.c
+++ b/src/testcurl/test_put_header_fold.c
@@ -1151,6 +1151,7 @@ performCheck (void)
                           port, NULL, NULL,
                           &ahcCheck, &ahc_param,
                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, mem_limit,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                           MHD_OPTION_END);
   }
   if (d == NULL)
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index be7b43b7..f4b76e93 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -320,6 +320,7 @@ ServeOneRequest (void *param)
                         0, NULL, NULL, &ahc_echo, NULL,
                         MHD_OPTION_LISTEN_SOCKET, fd,
                         MHD_OPTION_NOTIFY_COMPLETED, &request_completed, &done,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     mhdErrorExit ();
@@ -558,6 +559,7 @@ testExternalGet (void)
                         global_port,
                         NULL, NULL,
                         &ahc_echo, NULL,
+                        MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
                         MHD_OPTION_END);
   if (d == NULL)
     mhdErrorExitDesc ("Failed to start MHD daemon");
diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c
index 0fea130d..e5d519c3 100644
--- a/src/testcurl/test_toolarge.c
+++ b/src/testcurl/test_toolarge.c
@@ -1451,7 +1451,18 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       *pport += 16;
   }
 
-  if (testMhdThreadInternalPool != thrType)
+  if (testMhdThreadExternal == thrType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
+                          | (verbose ? MHD_USE_ERROR_LOG : 0),
+                          *pport, NULL, NULL,
+                          &ahcCheck, *ahc_param,
+                          MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb,
+                          *uri_cb_param,
+                          MHD_OPTION_CONNECTION_MEMORY_LIMIT,
+                          (size_t) BUFFER_SIZE,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                          MHD_OPTION_END);
+  else if (testMhdThreadInternalPool != thrType)
     d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c
index 493b3d69..b3f52484 100644
--- a/src/testcurl/test_tricky.c
+++ b/src/testcurl/test_tricky.c
@@ -962,7 +962,16 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
       *pport += 16;
   }
 
-  if (testMhdThreadInternalPool != thrType)
+  if (testMhdThreadExternal == thrType)
+    d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
+                          | (verbose ? MHD_USE_ERROR_LOG : 0),
+                          *pport, NULL, NULL,
+                          &ahcCheck, *ahc_param,
+                          MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb,
+                          *uri_cb_param,
+                          MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
+                          MHD_OPTION_END);
+  else if (testMhdThreadInternalPool != thrType)
     d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
                           | (verbose ? MHD_USE_ERROR_LOG : 0),
                           *pport, NULL, NULL,
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index 737e5cf0..c1a245d6 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -1174,22 +1174,35 @@ start_daemon_for_test (unsigned int daemon_flags, 
uint16_t *pport,
 {
   struct MHD_Daemon *d;
   struct MHD_OptionItem ops[] = {
+    { MHD_OPTION_END, 0, NULL },
     { MHD_OPTION_END, 0, NULL },
     { MHD_OPTION_END, 0, NULL }
   };
+  size_t num_opt;
+
+  num_opt = 0;
+
   callback_param->magic1 = (unsigned int) TEST_MAGIC_MARKER1;
   callback_param->err_flag = 0;
   callback_param->num_replies = 0;
 
   if (use_put_large)
   {
-    ops[0].option = MHD_OPTION_CONNECTION_MEMORY_LIMIT;
-    ops[0].value = (intptr_t) (PUT_LARGE_SIZE / 4);
+    ops[num_opt].option = MHD_OPTION_CONNECTION_MEMORY_LIMIT;
+    ops[num_opt].value = (intptr_t) (PUT_LARGE_SIZE / 4);
+    ++num_opt;
   }
   else if (use_long_header || use_long_uri)
   {
-    ops[0].option = MHD_OPTION_CONNECTION_MEMORY_LIMIT;
-    ops[0].value = (intptr_t) (TEST_STRING_VLONG_LEN / 2);
+    ops[num_opt].option = MHD_OPTION_CONNECTION_MEMORY_LIMIT;
+    ops[num_opt].value = (intptr_t) (TEST_STRING_VLONG_LEN / 2);
+    ++num_opt;
+  }
+  if (0 == (MHD_USE_INTERNAL_POLLING_THREAD & daemon_flags))
+  {
+    ops[num_opt].option = MHD_OPTION_APP_FD_SETSIZE;
+    ops[num_opt].value = (intptr_t) (FD_SETSIZE);
+    ++num_opt;
   }
   d = MHD_start_daemon (daemon_flags /* | MHD_USE_ERROR_LOG */,
                         *pport, NULL, NULL,

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