From 164b12b5583f96d4bd630147c9f821cbc0843134 Mon Sep 17 00:00:00 2001 From: bel Date: Fri, 2 Oct 2015 20:48:00 +0200 Subject: [PATCH] Add server side Javascript (Duktape) to feature check API --- include/civetweb.h | 2 ++ src/civetweb.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/civetweb.h b/include/civetweb.h index 24da6f07..c680a924 100644 --- a/include/civetweb.h +++ b/include/civetweb.h @@ -765,6 +765,8 @@ CIVETWEB_API int mg_get_response(struct mg_connection *conn, 8 support IPv6 (USE_IPV6 set) 16 support WebSocket (USE_WEBSOCKET set) 32 support Lua scripts and Lua server pages (USE_LUA is set) + 64 support server side JavaScript (USE_DUKTAPE is set) + The result is undefined for all other feature values. Return: If feature is available > 0 diff --git a/src/civetweb.c b/src/civetweb.c index 07fdd17d..1e5cafa5 100755 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -11603,7 +11603,9 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks, unsigned mg_check_feature(unsigned feature) { static const unsigned feature_set = 0 -/* Set bits for available features according to API documentation. */ +/* Set bits for available features according to API documentation. + * This bit mask is created at compile time, according to the active + * preprocessor defines. It is a single const value at runtime. */ #if !defined(NO_FILES) | 1 #endif @@ -11622,11 +11624,12 @@ unsigned mg_check_feature(unsigned feature) #if defined(USE_LUA) | 32 #endif -/* Set some extra bits not defined in the API documentation. - * These bits may change without further notice. */ -#if !defined(NO_POPEN) +#if defined(USE_DUKTAPE) | 64 #endif + +/* Set some extra bits not defined in the API documentation. + * These bits may change without further notice. */ #if defined(MG_LEGACY_INTERFACE) | 128 #endif @@ -11638,6 +11641,9 @@ unsigned mg_check_feature(unsigned feature) #endif #if !defined(NO_NONCE_CHECK) | 1024 +#endif +#if !defined(NO_POPEN) + | 2048 #endif ; return (feature & feature_set);