mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
MHD_daemon_get_info_fixed(): added information about used TLS backend
This commit is contained in:
@@ -9204,6 +9204,15 @@ enum MHD_DaemonInfoFixedType
|
||||
*/
|
||||
MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD = 3
|
||||
,
|
||||
/**
|
||||
* Get the TLS backend used by the daemon.
|
||||
* The value #MHD_TLS_BACKEND_ANY is never set in the returned data.
|
||||
* The value #MHD_TLS_BACKEND_NONE is set if the daemon does not use TLS.
|
||||
* If MHD built without TLS support then #MHD_TLS_BACKEND_NONE is always set.
|
||||
* The result is placed in @a v_tls_backend member.
|
||||
*/
|
||||
MHD_DAEMON_INFO_FIXED_TLS_TYPE = 100
|
||||
,
|
||||
|
||||
/* * Sentinel * */
|
||||
/**
|
||||
@@ -9237,6 +9246,11 @@ union MHD_DaemonInfoFixedData
|
||||
*/
|
||||
uint_least16_t v_port;
|
||||
|
||||
/**
|
||||
* The TLS backend
|
||||
*/
|
||||
enum MHD_TlsBackend v_tls_backend;
|
||||
|
||||
/**
|
||||
* Unused member.
|
||||
* Help enforcing future-proof alignment of the union.
|
||||
|
||||
@@ -4582,6 +4582,15 @@ enum MHD_DaemonInfoFixedType
|
||||
*/
|
||||
MHD_DAEMON_INFO_FIXED_AGGREAGATE_FD = 3
|
||||
,
|
||||
/**
|
||||
* Get the TLS backend used by the daemon.
|
||||
* The value #MHD_TLS_BACKEND_ANY is never set in the returned data.
|
||||
* The value #MHD_TLS_BACKEND_NONE is set if the daemon does not use TLS.
|
||||
* If MHD built without TLS support then #MHD_TLS_BACKEND_NONE is always set.
|
||||
* The result is placed in @a v_tls_backend member.
|
||||
*/
|
||||
MHD_DAEMON_INFO_FIXED_TLS_TYPE = 100
|
||||
,
|
||||
|
||||
/* * Sentinel * */
|
||||
/**
|
||||
@@ -4615,6 +4624,11 @@ union MHD_DaemonInfoFixedData
|
||||
*/
|
||||
uint_least16_t v_port;
|
||||
|
||||
/**
|
||||
* The TLS backend
|
||||
*/
|
||||
enum MHD_TlsBackend v_tls_backend;
|
||||
|
||||
/**
|
||||
* Unused member.
|
||||
* Help enforcing future-proof alignment of the union.
|
||||
|
||||
@@ -26,12 +26,20 @@
|
||||
|
||||
#include "mhd_sys_options.h"
|
||||
|
||||
#include "mhd_unreachable.h"
|
||||
|
||||
#include "sys_base_types.h"
|
||||
#include "sys_sockets_types.h"
|
||||
|
||||
#include "mhd_socket_type.h"
|
||||
#include "mhd_daemon.h"
|
||||
#include "events_process.h"
|
||||
#ifdef MHD_SUPPORT_HTTPS
|
||||
# include "mhd_tls_choice.h"
|
||||
# ifdef MHD_USE_MULTITLS
|
||||
# include "tls_multi_daemon_data.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "mhd_public_api.h"
|
||||
|
||||
@@ -84,6 +92,44 @@ MHD_daemon_get_info_fixed_sz (struct MHD_Daemon *daemon,
|
||||
return MHD_SC_INFO_GET_TYPE_NOT_SUPP_BY_BUILD;
|
||||
#endif
|
||||
break;
|
||||
case MHD_DAEMON_INFO_FIXED_TLS_TYPE:
|
||||
if (sizeof(output_buf->v_tls_backend) > output_buf_size)
|
||||
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
|
||||
if (! mhd_D_HAS_TLS (daemon))
|
||||
output_buf->v_tls_backend = MHD_TLS_BACKEND_NONE;
|
||||
else
|
||||
{
|
||||
#if ! defined(MHD_SUPPORT_HTTPS)
|
||||
mhd_UNREACHABLE ();
|
||||
#elif defined(MHD_USE_MULTITLS)
|
||||
switch (daemon->tls->choice)
|
||||
{
|
||||
# ifdef MHD_SUPPORT_GNUTLS
|
||||
case mhd_TLS_MULTI_ROUTE_GNU:
|
||||
output_buf->v_tls_backend = MHD_TLS_BACKEND_GNUTLS;
|
||||
break;
|
||||
# endif
|
||||
# ifdef MHD_SUPPORT_OPENSSL
|
||||
case mhd_TLS_MULTI_ROUTE_OPEN:
|
||||
output_buf->v_tls_backend = MHD_TLS_BACKEND_OPENSSL;
|
||||
break;
|
||||
# endif
|
||||
case mhd_TLS_MULTI_ROUTE_NONE:
|
||||
default:
|
||||
mhd_UNREACHABLE ();
|
||||
break;
|
||||
}
|
||||
#elif defined(MHD_SUPPORT_GNUTLS)
|
||||
output_buf->v_tls_backend = MHD_TLS_BACKEND_GNUTLS;
|
||||
#elif defined(MHD_SUPPORT_OPENSSL)
|
||||
output_buf->v_tls_backend = MHD_TLS_BACKEND_OPENSSL;
|
||||
#else
|
||||
#error No TLS backends enabled, while TLS support is enabled
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
return MHD_SC_OK;
|
||||
|
||||
case MHD_DAEMON_INFO_FIXED_SENTINEL:
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user