libmicrohttpd2

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

commit 91d5286b59ce4ce912fb23fb786542c69960489e
parent 248dc0456c448faac6de06e399d50b85ad28182d
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sat, 22 Mar 2025 17:13:08 +0300

Refactored MHD_request_get_info_fixed_sz() and relevant types

Resulting values now are individual for each query value.

Diffstat:
Msrc/include/microhttpd2.h | 28+++++++++++++++-------------
Msrc/include/microhttpd2_main.h.in | 28+++++++++++++++-------------
Msrc/mhd2/request_get_info.c | 4++--
3 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h @@ -10206,7 +10206,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoFixedType * #MHD_EarlyUriLogCallback and #MHD_RequestTerminationCallback. * By using provided pointer application may get or set the pointer to * any data specific for the particular request. - * The result is placed in @a v_ppvoid member. + * Note: resulting data is NOT the context pointer itself. + * The result is placed in @a v_app_context_ppvoid member. * @ingroup request */ MHD_REQUEST_INFO_FIXED_APP_CONTEXT = 30 @@ -10229,40 +10230,41 @@ union MHD_RequestInfoFixedData { /** - * The MHD stream handler type. + * The data for the #MHD_REQUEST_INFO_FIXED_HTTP_VER query */ - struct MHD_Stream *v_stream; + enum MHD_HTTP_ProtocolVersion v_http_ver; /** - * The MHD connection handler type. + * The data for the #MHD_REQUEST_INFO_FIXED_HTTP_METHOD query */ - struct MHD_Connection *v_connection; + enum MHD_HTTP_Method v_http_method; /** - * The MHD daemon handler type. + * The data for the #MHD_REQUEST_INFO_FIXED_DAEMON query */ struct MHD_Daemon *v_daemon; /** - * The HTTP version type. + * The data for the #MHD_REQUEST_INFO_FIXED_CONNECTION query */ - enum MHD_HTTP_ProtocolVersion v_http_ver; + struct MHD_Connection *v_connection; /** - * The HTTP method type. + * The data for the #MHD_REQUEST_INFO_FIXED_STREAM query */ - enum MHD_HTTP_Method v_http_method; + struct MHD_Stream *v_stream; /** - * The pointer to pointer to the data. + * The data for the #MHD_REQUEST_INFO_FIXED_APP_CONTEXT query */ - void **v_ppvoid; + void **v_app_context_ppvoid; }; /** * Obtain fixed information about the given request. * This information is not changed for the lifetime of the request. - * The wrapper macro #MHD_request_get_info_fixed() could be more convenient. + * + * The wrapper macro #MHD_request_get_info_fixed() may be more convenient. * * @param request the request to get information about * @param info_type the type of information requested diff --git a/src/include/microhttpd2_main.h.in b/src/include/microhttpd2_main.h.in @@ -5584,7 +5584,8 @@ enum MHD_FIXED_ENUM_APP_SET_ MHD_RequestInfoFixedType * #MHD_EarlyUriLogCallback and #MHD_RequestTerminationCallback. * By using provided pointer application may get or set the pointer to * any data specific for the particular request. - * The result is placed in @a v_ppvoid member. + * Note: resulting data is NOT the context pointer itself. + * The result is placed in @a v_app_context_ppvoid member. * @ingroup request */ MHD_REQUEST_INFO_FIXED_APP_CONTEXT = 30 @@ -5607,40 +5608,41 @@ union MHD_RequestInfoFixedData { /** - * The MHD stream handler type. + * The data for the #MHD_REQUEST_INFO_FIXED_HTTP_VER query */ - struct MHD_Stream *v_stream; + enum MHD_HTTP_ProtocolVersion v_http_ver; /** - * The MHD connection handler type. + * The data for the #MHD_REQUEST_INFO_FIXED_HTTP_METHOD query */ - struct MHD_Connection *v_connection; + enum MHD_HTTP_Method v_http_method; /** - * The MHD daemon handler type. + * The data for the #MHD_REQUEST_INFO_FIXED_DAEMON query */ struct MHD_Daemon *v_daemon; /** - * The HTTP version type. + * The data for the #MHD_REQUEST_INFO_FIXED_CONNECTION query */ - enum MHD_HTTP_ProtocolVersion v_http_ver; + struct MHD_Connection *v_connection; /** - * The HTTP method type. + * The data for the #MHD_REQUEST_INFO_FIXED_STREAM query */ - enum MHD_HTTP_Method v_http_method; + struct MHD_Stream *v_stream; /** - * The pointer to pointer to the data. + * The data for the #MHD_REQUEST_INFO_FIXED_APP_CONTEXT query */ - void **v_ppvoid; + void **v_app_context_ppvoid; }; /** * Obtain fixed information about the given request. * This information is not changed for the lifetime of the request. - * The wrapper macro #MHD_request_get_info_fixed() could be more convenient. + * + * The wrapper macro #MHD_request_get_info_fixed() may be more convenient. * * @param request the request to get information about * @param info_type the type of information requested diff --git a/src/mhd2/request_get_info.c b/src/mhd2/request_get_info.c @@ -98,9 +98,9 @@ MHD_request_get_info_fixed_sz ( rq)->h1_stream); return MHD_SC_OK; case MHD_REQUEST_INFO_FIXED_APP_CONTEXT: - if (sizeof(output_buf->v_ppvoid) > output_buf_size) + if (sizeof(output_buf->v_app_context_ppvoid) > output_buf_size) return MHD_SC_INFO_GET_BUFF_TOO_SMALL; - output_buf->v_ppvoid = &(request->app_context); + output_buf->v_app_context_ppvoid = &(request->app_context); return MHD_SC_OK; case MHD_REQUEST_INFO_FIXED_SENTINEL: