mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-10-06 04:03:18 +03:00
Added new function MHD_is_feature_supported()
This commit is contained in:
1 parent
3bc4813f52
commit
52a6587591
4 files changed
+220
No files matched your search
@@ -1,3 +1,6 @@
|
||||
Sat Mar 29 16:12:03 CET 2014
|
||||
Added MHD_is_feature_supported() function. -EG
|
||||
|
||||
Thu Mar 27 14:47:54 CET 2014
|
||||
Used larger FD_SETSIZE internally on W32.
|
||||
Extended API to work with non-default FD_SETSIZE. -EG
|
||||
|
||||
@@ -491,6 +491,10 @@ AC_ARG_ENABLE([postprocessor],
|
||||
test "x$enable_postprocessor" = "xno" || enable_postprocessor=yes
|
||||
AC_MSG_RESULT([[$enable_postprocessor]])
|
||||
AM_CONDITIONAL([HAVE_POSTPROCESSOR],test "x$enable_postprocessor" != "xno")
|
||||
if test "x$enable_postprocessor" != "xno"
|
||||
then
|
||||
AC_DEFINE([HAVE_POSTPROCESSOR],[1],[define to 1 if MHD was build with postprocessor.c])
|
||||
fi
|
||||
|
||||
|
||||
# optional: have zzuf, socat?
|
||||
|
||||
@@ -2353,6 +2353,120 @@ _MHD_EXTERN const char*
|
||||
MHD_get_version (void);
|
||||
|
||||
|
||||
/**
|
||||
* Types of information about MHD features,
|
||||
* used by #MHD_is_feature_supported.
|
||||
*/
|
||||
enum MHD_FEATURE
|
||||
{
|
||||
/**
|
||||
* Get whether messages are supported. If supported then in debug
|
||||
* mode messages can be printed to stderr or to external logger.
|
||||
*/
|
||||
MHD_FEATURE_MESSGES = 1,
|
||||
|
||||
/**
|
||||
* Get whether HTTPS is supported. If supported then flag
|
||||
* #MHD_USE_SSL and options #MHD_OPTION_HTTPS_MEM_KEY,
|
||||
* #MHD_OPTION_HTTPS_MEM_CERT, #MHD_OPTION_HTTPS_MEM_TRUST
|
||||
* #MHD_OPTION_HTTPS_CRED_TYPE, #MHD_OPTION_HTTPS_PRIORITIES
|
||||
* can be used.
|
||||
*/
|
||||
MHD_FEATURE_SSL = 2,
|
||||
|
||||
/**
|
||||
* Get whether option #MHD_OPTION_HTTPS_CERT_CALLBACK is
|
||||
* supported.
|
||||
*/
|
||||
MHD_FEATURE_HTTPS_CERT_CALLBACK = 3,
|
||||
|
||||
/**
|
||||
* Get whether IPv6 is supported. If supported then flag
|
||||
* #MHD_USE_IPv6 can be used.
|
||||
*/
|
||||
MHD_FEATURE_IPv6 = 4,
|
||||
|
||||
/**
|
||||
* Get whether IPv6 without IPv4 is supported. If not supported
|
||||
* then IPv4 is always enabled in IPv6 sockets and
|
||||
* flag #MHD_USE_DUAL_STACK if always used when #MHD_USE_IPv6 is
|
||||
* specified.
|
||||
*/
|
||||
MHD_FEATURE_IPv6_ONLY = 5,
|
||||
|
||||
/**
|
||||
* Get whether `poll()` is supported. If supported then flag
|
||||
* #MHD_USE_POLL can be used.
|
||||
*/
|
||||
MHD_FEATURE_POLL = 6,
|
||||
|
||||
/**
|
||||
* Get whether `epoll()` is supported. If supported then Flags
|
||||
* #MHD_USE_EPOLL_LINUX_ONLY and
|
||||
* #MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used.
|
||||
*/
|
||||
MHD_FEATURE_EPOLL = 7,
|
||||
|
||||
/**
|
||||
* Get whether shutdown on listen socket to signal other
|
||||
* threads is supported. If not supported flag
|
||||
* MHD_USE_PIPE_FOR_SHUTDOWN is automatically forced.
|
||||
*/
|
||||
MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET = 8,
|
||||
|
||||
/**
|
||||
* Get whether socketpair is used internally instead of pipe to
|
||||
* signal other threads.
|
||||
*/
|
||||
MHD_FEATURE_SOCKETPAIR = 9,
|
||||
|
||||
/**
|
||||
* Get whether TCP Fast Open is supported. If supported then
|
||||
* flag #MHD_USE_TCP_FASTOPEN and option
|
||||
* #MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE can be used.
|
||||
*/
|
||||
MHD_FEATURE_TCP_FASTOPEN = 10,
|
||||
|
||||
/**
|
||||
* Get whether HTTP Basic authorization is supported. If supported
|
||||
* then functions #MHD_basic_auth_get_username_password and
|
||||
* #MHD_queue_basic_auth_fail_response can be used.
|
||||
*/
|
||||
MHD_FEATURE_BASIC_AUTH = 11,
|
||||
|
||||
/**
|
||||
* Get whether HTTP Digest authorization is supported. If
|
||||
* supported then options #MHD_OPTION_DIGEST_AUTH_RANDOM,
|
||||
* #MHD_OPTION_NONCE_NC_SIZE and functions #MHD_digest_auth_check,
|
||||
* #MHD_digest_auth_check can be used.
|
||||
*/
|
||||
MHD_FEATURE_DIGEST_AUTH = 12,
|
||||
|
||||
/**
|
||||
* Get whether postprocessor is supported. If supported then
|
||||
* functions #MHD_create_post_processor, #MHD_post_process,
|
||||
* #MHD_destroy_post_processor, #MHD_destroy_post_processor can
|
||||
* be used.
|
||||
*/
|
||||
MHD_FEATURE_POSTPROCESSOR = 13,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get information about supported MHD features.
|
||||
* Indicate that MHD was compiled with or without support for
|
||||
* particular feature. Some features require additional support
|
||||
* by kernel. Kernel support is not checked by this function.
|
||||
*
|
||||
* @param feature type of requested information
|
||||
* @return #MHD_YES if feature is supported by MHD, #MHD_NO if
|
||||
* feature is not supported or feature is unknown.
|
||||
* @ingroup specialized
|
||||
*/
|
||||
_MHD_EXTERN int
|
||||
MHD_is_feature_supported(enum MHD_FEATURE feature);
|
||||
|
||||
|
||||
#if 0 /* keep Emacsens' auto-indent happy */
|
||||
{
|
||||
#endif
|
||||
|
||||
@@ -4235,6 +4235,105 @@ MHD_get_version (void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get information about supported MHD features.
|
||||
* Indicate that MHD was compiled with or without support for
|
||||
* particular feature. Some features require additional support
|
||||
* by kernel. Kernel support is not checked by this function.
|
||||
*
|
||||
* @param feature type of requested information
|
||||
* @return #MHD_YES if feature is supported by MHD, #MHD_NO if
|
||||
* feature is not supported or feature is unknown.
|
||||
* @ingroup specialized
|
||||
*/
|
||||
_MHD_EXTERN int
|
||||
MHD_is_feature_supported(enum MHD_FEATURE feature)
|
||||
{
|
||||
switch(feature)
|
||||
{
|
||||
case MHD_FEATURE_MESSGES:
|
||||
#if HAVE_MESSAGES
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_SSL:
|
||||
#if HTTPS_SUPPORT
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_HTTPS_CERT_CALLBACK:
|
||||
#if HTTPS_SUPPORT && GNUTLS_VERSION_MAJOR >= 3
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_IPv6:
|
||||
#ifdef HAVE_INET6
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_IPv6_ONLY:
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_POLL:
|
||||
#ifdef HAVE_POLL_H
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_EPOLL:
|
||||
#if EPOLL_SUPPORT
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET:
|
||||
#ifdef HAVE_LISTEN_SHUTDOWN
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_SOCKETPAIR:
|
||||
#ifdef MHD_DONT_USE_PIPES
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_TCP_FASTOPEN:
|
||||
#ifdef TCP_FASTOPEN
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_BASIC_AUTH:
|
||||
#if BAUTH_SUPPORT
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_DIGEST_AUTH:
|
||||
#if DAUTH_SUPPORT
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
case MHD_FEATURE_POSTPROCESSOR:
|
||||
#if HAVE_POSTPROCESSOR
|
||||
return MHD_YES;
|
||||
#else
|
||||
return MHD_NO;
|
||||
#endif
|
||||
}
|
||||
return MHD_NO;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define FUNC_CONSTRUCTOR(f) static void __attribute__ ((constructor)) f
|
||||
#define FUNC_DESTRUCTOR(f) static void __attribute__ ((destructor)) f
|
||||
|
||||
Reference in new issue
Block a user