This commit is contained in:
Christian Grothoff
2024-06-11 14:15:40 +02:00
parent c8a3beb19e
commit e5d6647003
5 changed files with 33 additions and 19 deletions
+11 -1
View File
@@ -73,6 +73,11 @@ Description1: the size of the socket address pointed by @a sa.
Argument2: const struct sockaddr *sa
Description2: the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX)
CustomSetter: /* custom setter */
+ #if FIXME_EG
+ struct sockaddr_storage bind_sa;
+ if (option->val.bind_sa.v_sa_len > sizeof (bind_sa)) return FREAKOUT;
+ memcpy (&settings->bind_sa, option->val.bind_sa.v_sa, option->val.bind_sa.v_sa_len);
+ #endif
+ if (0 != option->val.bind_sa.v_sa_len)
+ {
+ if (NULL != settings->bind_sa.v_sa)
@@ -203,7 +208,7 @@ Name: PER_IP_LIMIT
Value: 162
Comment: Limit on the number of (concurrent) network connections made to the server from the same IP address.
+ Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected.
Argument1: unsigned int per_ip_limit
Argument1: unsigned int limit
Description1: FIXME
Name: accept_policy
@@ -380,6 +385,11 @@ Description2: the buffer with strong random data, the content will be copied by
CustomSetter: /* custom setter */
+ if (0 != option->val.random_entropy.v_buf_size)
+ {
+ #if FIXME_EG
+ MHD_entropy_hash_ (&settings->random_entropy,
+ option->val.random_entropy.v_buf,
+ option->val.random_entropy.v_buf_size);
+ #endif
+ if (NULL != settings->random_entropy.v_buf)
+ free (settings->random_entropy.v_buf);
+ settings->random_entropy.v_buf
+2 -2
View File
@@ -3332,12 +3332,12 @@ MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT (
/**
* Limit on the number of (concurrent) network connections made to the server from the same IP address.
* Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected.
* @param per_ip_limit FIXME
* @param limit FIXME
* @return structure with the requested setting
*/
struct MHD_DaemonOptionAndValue
MHD_D_OPTION_PER_IP_LIMIT (
unsigned int per_ip_limit
unsigned int limit
);
/**
@@ -1102,15 +1102,15 @@ Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used.
/**
* Limit on the number of (concurrent) network connections made to the server from the same IP address.
* Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected.
* @param per_ip_limit FIXME
* @param limit FIXME
* @return structure with the requested setting
*/
# define MHD_D_OPTION_PER_IP_LIMIT(per_ip_limit) \
# define MHD_D_OPTION_PER_IP_LIMIT(limit) \
MHD_NOWARN_COMPOUND_LITERALS_ \
(const struct MHD_DaemonOptionAndValue) \
{ \
.opt = MHD_D_O_PER_IP_LIMIT, \
.val.per_ip_limit = (per_ip_limit) \
.val.per_ip_limit = (limit) \
} \
MHD_RESTORE_WARN_COMPOUND_LITERALS_
/**
@@ -1852,18 +1852,18 @@ MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT (
/**
* Limit on the number of (concurrent) network connections made to the server from the same IP address.
* Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected.
* @param per_ip_limit FIXME
* @param limit FIXME
* @return structure with the requested setting
*/
static MHD_INLINE struct MHD_daemonOptionAndValue
MHD_D_OPTION_PER_IP_LIMIT (
unsigned int per_ip_limit
unsigned int limit
)
{
struct MHD_DaemonOptionAndValue opt_val;
opt_val.opt = MHD_D_O_PER_IP_LIMIT;
opt_val.val.per_ip_limit = per_ip_limit;
opt_val.val.per_ip_limit = limit;
return opt_val;
}
+7 -5
View File
@@ -21,16 +21,17 @@ MHD_daemon_set_options (
const struct MHD_DaemonOptionAndValue *options,
size_t options_max_num)
{
struct DaemonOptions *const settings = daemon->settings;
struct DaemonOptions *const settings = daemon->psettings;
size_t i;
if (daemon->frozen)
if (NULL == settings)
return MHD_SC_TOO_LATE;
for (i=0;i<options_max_num;i++)
for (i = 0; i < options_max_num; i++)
{
const struct MHD_DaemonOptionAndValue *const option = options + i;
switch (option->opt) {
const struct MHD_daemonOptionAndValue *const option = options + i;
switch (option->opt)
{
case MHD_D_O_END:
return MHD_SC_OK;
case MHD_D_O_WORK_MODE:
@@ -193,6 +194,7 @@ MHD_daemon_set_options (
settings->dauth_def_max_nc = option->val.dauth_def_max_nc;
continue;
case MHD_D_O_SENTINEL:
default: /* for -WFIXME_EG */
break;
}
return MHD_SC_OPTION_UNKNOWN;
+7 -5
View File
@@ -21,16 +21,17 @@ MHD_response_set_options (
const struct MHD_ResponseOptionAndValue *options,
size_t options_max_num)
{
struct ResponseOptions *const settings = response->settings;
struct ResponseOptions *const settings = response->psettings;
size_t i;
if (response->frozen)
if (NULL == settings)
return MHD_SC_TOO_LATE;
for (i=0;i<options_max_num;i++)
for (i = 0; i < options_max_num; i++)
{
const struct MHD_ResponseOptionAndValue *const option = options + i;
switch (option->opt) {
const struct MHD_responseOptionAndValue *const option = options + i;
switch (option->opt)
{
case MHD_R_O_END:
return MHD_SC_OK;
case MHD_R_O_REUSABLE:
@@ -59,6 +60,7 @@ MHD_response_set_options (
settings->termination_callback.v_term_cb_cls = option->val.termination_callback.v_term_cb_cls;
continue;
case MHD_R_O_SENTINEL:
default: /* for -WFIXME_EG */
break;
}
return MHD_SC_OPTION_UNKNOWN;