diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h index 4ca70d58..c3581ed7 100644 --- a/src/include/microhttpd2.h +++ b/src/include/microhttpd2.h @@ -9498,6 +9498,19 @@ enum MHD_ConnectionInfoFixedType */ MHD_CONNECTION_INFO_FIXED_DAEMON = 20 , + /** + * Returns the pointer to a variable pointing to connection-specific + * application context data that was (possibly) set during + * a #MHD_NotifyConnectionCallback or provided via @a connection_cntx + * parameter of #MHD_daemon_add_connection(). + * By using provided pointer application may get or set the pointer to + * any data specific for the particular connection. + * The result is placed in @a v_ppvoid member. + * @ingroup request + */ + MHD_CONNECTION_INFO_FIXED_SOCKET_CONTEXT = 30 + , + /* * Sentinel * */ /** * The sentinel value. @@ -9540,6 +9553,11 @@ union MHD_ConnectionInfoFixedData * Daemon handler type */ struct MHD_Daemon *v_daemon; + + /** + * The pointer to pointer to the data + */ + void **v_ppvoid; }; @@ -9641,14 +9659,6 @@ enum MHD_ConnectionInfoDynamicType */ MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_SUSPENDED = 11 , - /** - * Returns the connection-specific application context data that was - * (possibly) set during a #MHD_NotifyConnectionCallback or provided via - * @a connection_cntx parameter of #MHD_daemon_add_connection(). - * The result is placed in @a v_pvoid member. - */ - MHD_CONNECTION_INFO_DYNAMIC_SOCKET_CONTEXT = 20 - , /** * Get current version of TLS transport protocol used for connection * If plain TCP connection is used then #MHD_TLS_VERSION_NO_TLS set in @@ -9775,11 +9785,6 @@ union MHD_ConnectionInfoDynamicData */ enum MHD_Bool v_bool; - /** - * The pointer to void type - */ - void *v_pvoid; - /** * The TLS version */ diff --git a/src/include/microhttpd2_main.h.in b/src/include/microhttpd2_main.h.in index 08a84cbf..c272b5f5 100644 --- a/src/include/microhttpd2_main.h.in +++ b/src/include/microhttpd2_main.h.in @@ -4876,6 +4876,19 @@ enum MHD_ConnectionInfoFixedType */ MHD_CONNECTION_INFO_FIXED_DAEMON = 20 , + /** + * Returns the pointer to a variable pointing to connection-specific + * application context data that was (possibly) set during + * a #MHD_NotifyConnectionCallback or provided via @a connection_cntx + * parameter of #MHD_daemon_add_connection(). + * By using provided pointer application may get or set the pointer to + * any data specific for the particular connection. + * The result is placed in @a v_ppvoid member. + * @ingroup request + */ + MHD_CONNECTION_INFO_FIXED_SOCKET_CONTEXT = 30 + , + /* * Sentinel * */ /** * The sentinel value. @@ -4918,6 +4931,11 @@ union MHD_ConnectionInfoFixedData * Daemon handler type */ struct MHD_Daemon *v_daemon; + + /** + * The pointer to pointer to the data + */ + void **v_ppvoid; }; @@ -5019,14 +5037,6 @@ enum MHD_ConnectionInfoDynamicType */ MHD_CONNECTION_INFO_DYNAMIC_CONNECTION_SUSPENDED = 11 , - /** - * Returns the connection-specific application context data that was - * (possibly) set during a #MHD_NotifyConnectionCallback or provided via - * @a connection_cntx parameter of #MHD_daemon_add_connection(). - * The result is placed in @a v_pvoid member. - */ - MHD_CONNECTION_INFO_DYNAMIC_SOCKET_CONTEXT = 20 - , /** * Get current version of TLS transport protocol used for connection * If plain TCP connection is used then #MHD_TLS_VERSION_NO_TLS set in @@ -5153,11 +5163,6 @@ union MHD_ConnectionInfoDynamicData */ enum MHD_Bool v_bool; - /** - * The pointer to void type - */ - void *v_pvoid; - /** * The TLS version */ diff --git a/src/mhd2/conn_get_info.c b/src/mhd2/conn_get_info.c index 655dc306..93629729 100644 --- a/src/mhd2/conn_get_info.c +++ b/src/mhd2/conn_get_info.c @@ -74,6 +74,11 @@ MHD_connection_get_info_fixed_sz ( return MHD_SC_INFO_GET_BUFF_TOO_SMALL; output_buf->v_daemon = mhd_daemon_get_master_daemon (connection->daemon); return MHD_SC_OK; + case MHD_CONNECTION_INFO_FIXED_SOCKET_CONTEXT: + if (sizeof(output_buf->v_ppvoid) > output_buf_size) + return MHD_SC_INFO_GET_BUFF_TOO_SMALL; + output_buf->v_ppvoid = &(connection->socket_context); + return MHD_SC_OK; case MHD_CONNECTION_INFO_FIXED_SENTINEL: default: @@ -116,11 +121,6 @@ MHD_connection_get_info_dynamic_sz ( return MHD_SC_INFO_GET_BUFF_TOO_SMALL; output_buf->v_bool = connection->suspended ? MHD_YES : MHD_NO; return MHD_SC_OK; - case MHD_CONNECTION_INFO_DYNAMIC_SOCKET_CONTEXT: - if (sizeof(output_buf->v_pvoid) > output_buf_size) - return MHD_SC_INFO_GET_BUFF_TOO_SMALL; - output_buf->v_pvoid = connection->socket_context; - return MHD_SC_OK; case MHD_CONNECTION_INFO_DYNAMIC_TLS_VER: #ifdef MHD_SUPPORT_HTTPS if ((mhd_CONN_STATE_TCP_CONNECTED != connection->conn_state) &&