mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
|
||||
+141
-12
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
+17
-4
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user