libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit fdfd2715b372cd5c9439db35ed37b2da07c989c4
parent 321a18b6a6080a374ef9d5e89c9a09e1a10bbd09
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Wed, 24 Dec 2025 20:42:02 +0100

Changed reported connection timeout to milliseconds

Diffstat:
Msrc/include/microhttpd2.h | 19++++++++++---------
Msrc/include/microhttpd2_main.h.in | 19++++++++++---------
Msrc/mhd2/conn_get_info.c | 10++++------
3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h @@ -9619,7 +9619,7 @@ union MHD_DaemonInfoFixedData enum MHD_TlsBackend v_tls_backend; /** - * The data for the #MHD_DAEMON_INFO_FIXED_DEFAULT_TIMEOUT query + * The data for the #MHD_DAEMON_INFO_FIXED_DEFAULT_TIMEOUT_MILSEC query */ uint_fast32_t v_default_timeout_milsec_uint32; @@ -10043,14 +10043,14 @@ enum MHD_ConnectionInfoDynamicType , /** * Get connection timeout value. - * This is the total number of seconds after which the idle connection is - * automatically disconnected. - * Note: the value set is NOT the number of seconds left before automatic - * disconnection. - * The result is placed in @a v_connection_timeout_uint member. + * This is the total number of milliseconds after which the idle + * connection is automatically disconnected. + * Note: the value set is NOT the number of milliseconds left before + * automatic disconnection. + * The result is placed in @a v_connection_timeout_uint32 member. * @ingroup request */ - MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT = 10 + MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT_MILSEC = 10 , /** * Check whether the connection is suspended. @@ -10187,9 +10187,10 @@ union MHD_ConnectionInfoDynamicData enum MHD_HTTP_ProtocolVersion v_http_ver; /** - * The data for the #MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT query + * The data for the #MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT_MILSEC + * query */ - unsigned int v_connection_timeout_uint; + uint_fast32_t v_connection_timeout_uint32; /** * The data for the #MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_SUSPENDED query diff --git a/src/include/microhttpd2_main.h.in b/src/include/microhttpd2_main.h.in @@ -4744,7 +4744,7 @@ union MHD_DaemonInfoFixedData enum MHD_TlsBackend v_tls_backend; /** - * The data for the #MHD_DAEMON_INFO_FIXED_DEFAULT_TIMEOUT query + * The data for the #MHD_DAEMON_INFO_FIXED_DEFAULT_TIMEOUT_MILSEC query */ uint_fast32_t v_default_timeout_milsec_uint32; @@ -5168,14 +5168,14 @@ enum MHD_ConnectionInfoDynamicType , /** * Get connection timeout value. - * This is the total number of seconds after which the idle connection is - * automatically disconnected. - * Note: the value set is NOT the number of seconds left before automatic - * disconnection. - * The result is placed in @a v_connection_timeout_uint member. + * This is the total number of milliseconds after which the idle + * connection is automatically disconnected. + * Note: the value set is NOT the number of milliseconds left before + * automatic disconnection. + * The result is placed in @a v_connection_timeout_uint32 member. * @ingroup request */ - MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT = 10 + MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT_MILSEC = 10 , /** * Check whether the connection is suspended. @@ -5312,9 +5312,10 @@ union MHD_ConnectionInfoDynamicData enum MHD_HTTP_ProtocolVersion v_http_ver; /** - * The data for the #MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT query + * The data for the #MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT_MILSEC + * query */ - unsigned int v_connection_timeout_uint; + uint_fast32_t v_connection_timeout_uint32; /** * The data for the #MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_SUSPENDED query diff --git a/src/mhd2/conn_get_info.c b/src/mhd2/conn_get_info.c @@ -126,13 +126,11 @@ MHD_connection_get_info_dynamic_sz ( return MHD_SC_INFO_GET_BUFF_TOO_SMALL; output_buf->v_http_ver = connection->rq.http_ver; return MHD_SC_OK; - case MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT: - if (sizeof(output_buf->v_connection_timeout_uint) <= output_buf_size) + case MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_TIMEOUT_MILSEC: + if (sizeof(output_buf->v_connection_timeout_uint32) <= output_buf_size) { - const uint_fast64_t tmout_ms = connection->connection_timeout_ms; - const unsigned int tmout = (unsigned int) (tmout_ms / 1000); - mhd_assert ((1000 * ((uint_fast64_t) tmout)) == tmout_ms); - output_buf->v_connection_timeout_uint = tmout; + output_buf->v_connection_timeout_uint32 = + connection->connection_timeout_ms; return MHD_SC_OK; } return MHD_SC_INFO_GET_BUFF_TOO_SMALL;