diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | aclk/aclk_query.c | 10 | ||||
-rw-r--r-- | config.cmake.h.in | 1 | ||||
-rw-r--r-- | configure.ac | 27 | ||||
-rw-r--r-- | daemon/buildinfo.c | 12 | ||||
-rw-r--r-- | daemon/main.c | 3 | ||||
-rw-r--r-- | libnetdata/libnetdata.h | 2 | ||||
-rw-r--r-- | web/server/web_client.c | 20 | ||||
-rw-r--r-- | web/server/web_client.h | 4 |
10 files changed, 8 insertions, 76 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b220af9f1a..e72775b4db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,6 @@ pkg_check_modules(ZLIB REQUIRED zlib) set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${ZLIB_CFLAGS_OTHER}) set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${ZLIB_LIBRARIES}) set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}) -# set(NETDATA_REQUIRED_DEFINES "${NETDATA_REQUIRED_DEFINES} -DNETDATA_WITH_ZLIB=1") # ----------------------------------------------------------------------------- # libuv multi-platform support library with a focus on asynchronous I/O diff --git a/Makefile.am b/Makefile.am index 7ade016cb7..8fa4194d2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -118,7 +118,7 @@ SUBDIRS += \ AM_CFLAGS = \ $(OPTIONAL_MATH_CFLAGS) \ $(OPTIONAL_NFACCT_CFLAGS) \ - $(OPTIONAL_ZLIB_CFLAGS) \ + $(ZLIB_CFLAGS) \ $(OPTIONAL_UUID_CFLAGS) \ $(OPTIONAL_MQTT_CFLAGS) \ $(OPTIONAL_LIBCAP_LIBS) \ @@ -1108,7 +1108,7 @@ endif NETDATA_COMMON_LIBS = \ $(OPTIONAL_MATH_LIBS) \ $(OPTIONAL_BPF_LIBS) \ - $(OPTIONAL_ZLIB_LIBS) \ + $(ZLIB_LIBS) \ $(OPTIONAL_SSL_LIBS) \ $(OPTIONAL_UUID_LIBS) \ $(OPTIONAL_MQTT_LIBS) \ diff --git a/aclk/aclk_query.c b/aclk/aclk_query.c index 46d1e1e5e3..4c2e918a3a 100644 --- a/aclk/aclk_query.c +++ b/aclk/aclk_query.c @@ -95,11 +95,9 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query) size_t size = 0; size_t sent = 0; -#ifdef NETDATA_WITH_ZLIB int z_ret; BUFFER *z_buffer = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE, &netdata_buffers_statistics.buffers_aclk); char *start, *end; -#endif struct web_client *w = web_client_get_from_cache(); w->acl = WEB_CLIENT_ACL_ACLK; @@ -152,7 +150,6 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query) size = w->response.data->len; sent = size; -#ifdef NETDATA_WITH_ZLIB // check if gzip encoding can and should be used if ((start = strstr((char *)query->data.http_api_v2.payload, WEB_HDR_ACCEPT_ENC))) { start += strlen(WEB_HDR_ACCEPT_ENC); @@ -199,7 +196,6 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query) w->response.data = z_buffer; z_buffer = NULL; } -#endif w->response.data->date = w->timings.tv_ready.tv_sec; web_client_build_http_header(w); @@ -209,18 +205,14 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query) buffer_strcat(local_buffer, w->response.header_output->buffer); if (w->response.data->len) { -#ifdef NETDATA_WITH_ZLIB if (w->response.zinitialized) { buffer_need_bytes(local_buffer, w->response.data->len); memcpy(&local_buffer->buffer[local_buffer->len], w->response.data->buffer, w->response.data->len); local_buffer->len += w->response.data->len; sent = sent - size + w->response.data->len; } else { -#endif buffer_strcat(local_buffer, w->response.data->buffer); -#ifdef NETDATA_WITH_ZLIB } -#endif } // send msg. @@ -249,9 +241,7 @@ cleanup: pending_req_list_rm(query->msg_id); -#ifdef NETDATA_WITH_ZLIB buffer_free(z_buffer); -#endif buffer_free(local_buffer); return retval; } diff --git a/config.cmake.h.in b/config.cmake.h.in index e0faaa4cfd..c1bebc1ba6 100644 --- a/config.cmake.h.in +++ b/config.cmake.h.in @@ -35,7 +35,6 @@ #cmakedefine ENABLE_PROMETHEUS_REMOTE_WRITE /* they are defined as REQUIRED in CMakeLists.txt */ -#define NETDATA_WITH_ZLIB 1 #define ENABLE_JSONC 1 #cmakedefine ENABLE_ML diff --git a/configure.ac b/configure.ac index 49015b297f..6b3985a3a0 100644 --- a/configure.ac +++ b/configure.ac @@ -130,12 +130,6 @@ AC_ARG_WITH( [with_libcap="detect"] ) AC_ARG_WITH( - [zlib], - [AS_HELP_STRING([--without-zlib], [build without zlib @<:@default enabled@:>@])], - , - [with_zlib="yes"] -) -AC_ARG_WITH( [math], [AS_HELP_STRING([--without-math], [build without math @<:@default enabled@:>@])], , @@ -481,19 +475,7 @@ PKG_CHECK_MODULES( [have_zlib=yes], [have_zlib=no] ) -test "${with_zlib}" = "yes" -a "${have_zlib}" != "yes" && AC_MSG_ERROR([zlib required but not found. Try installing 'zlib1g-dev' or 'zlib-devel'.]) - -AC_MSG_CHECKING([if zlib should be used]) -if test "${with_zlib}" != "no" -a "${have_zlib}" = "yes"; then - with_zlib="yes" - AC_DEFINE([NETDATA_WITH_ZLIB], [1], [zlib usability]) - OPTIONAL_ZLIB_CFLAGS="${ZLIB_CFLAGS}" - OPTIONAL_ZLIB_LIBS="${ZLIB_LIBS}" -else - with_zlib="no" -fi -AC_MSG_RESULT([${with_zlib}]) - +test "${have_zlib}" != "yes" && AC_MSG_ERROR([zlib required but not found. Try installing 'zlib1g-dev' or 'zlib-devel'.]) # ----------------------------------------------------------------------------- # libuuid @@ -1723,7 +1705,7 @@ AC_SUBST([netdata_user]) AC_SUBST([libsysdir]) CFLAGS="${originalCFLAGS} ${OPTIONAL_LTO_CFLAGS} ${OPTIONAL_PROTOBUF_CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} \ - ${OPTIONAL_ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \ + ${ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \ ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \ ${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PUBSUB_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} \ ${OPTIONAL_MONGOC_CFLAGS} ${LWS_CFLAGS} ${OPTIONAL_JSONC_STATIC_CFLAGS} ${OPTIONAL_YAML_STATIC_CFLAGS} ${OPTIONAL_BPF_CFLAGS} ${JUDY_CFLAGS} \ @@ -1752,8 +1734,8 @@ AC_SUBST([OPTIONAL_JSONC_LIBS]) AC_SUBST([OPTIONAL_YAML_LIBS]) AC_SUBST([OPTIONAL_NFACCT_CFLAGS]) AC_SUBST([OPTIONAL_NFACCT_LIBS]) -AC_SUBST([OPTIONAL_ZLIB_CFLAGS]) -AC_SUBST([OPTIONAL_ZLIB_LIBS]) +AC_SUBST([ZLIB_CFLAGS]) +AC_SUBST([ZLIB_LIBS]) AC_SUBST([OPTIONAL_UUID_CFLAGS]) AC_SUBST([OPTIONAL_UUID_LIBS]) AC_SUBST([OPTIONAL_BPF_CFLAGS]) @@ -1934,4 +1916,3 @@ AC_CONFIG_FILES([ AC_OUTPUT test "${with_math}" != "yes" && AC_MSG_WARN([You are building without math. math allows accurate calculations. It should be enabled.]) || : -test "${with_zlib}" != "yes" && AC_MSG_WARN([You are building without zlib. zlib allows netdata to transfer a lot less data with web clients. It should be enabled.]) || : diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c index 50f3b3a8e5..5afcd5490c 100644 --- a/daemon/buildinfo.c +++ b/daemon/buildinfo.c @@ -95,12 +95,6 @@ #define FEAT_LIBCAP 0 #endif -#ifdef NETDATA_WITH_ZLIB -#define FEAT_ZLIB 1 -#else -#define FEAT_ZLIB 0 -#endif - #ifdef STORAGE_WITH_MATH #define FEAT_LIBM 1 #else @@ -291,7 +285,7 @@ void print_build_info(void) { printf(" libcrypto: %s\n", FEAT_YES_NO(FEAT_CRYPTO)); printf(" libm: %s\n", FEAT_YES_NO(FEAT_LIBM)); printf(" tcalloc: %s\n", FEAT_YES_NO(FEAT_TCMALLOC)); - printf(" zlib: %s\n", FEAT_YES_NO(FEAT_ZLIB)); + printf(" zlib: %s\n", FEAT_YES_NO(1)); printf("Plugins:\n"); printf(" apps: %s\n", FEAT_YES_NO(FEAT_APPS_PLUGIN)); @@ -348,7 +342,7 @@ void print_build_info_json(void) { printf(" \"libcrypto\": %s,\n", FEAT_JSON_BOOL(FEAT_CRYPTO)); printf(" \"libm\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBM)); printf(" \"tcmalloc\": %s,\n", FEAT_JSON_BOOL(FEAT_TCMALLOC)); - printf(" \"zlib\": %s\n", FEAT_JSON_BOOL(FEAT_ZLIB)); + printf(" \"zlib\": %s\n", FEAT_JSON_BOOL(1)); printf(" },\n"); printf(" \"plugins\": {\n"); @@ -425,9 +419,7 @@ void analytics_build_info(BUFFER *b) { #ifdef ENABLE_TCMALLOC add_to_bi(b, "tcalloc"); #endif -#ifdef NETDATA_WITH_ZLIB add_to_bi(b, "zlib"); -#endif #ifdef ENABLE_APPS_PLUGIN add_to_bi(b, "apps"); diff --git a/daemon/main.c b/daemon/main.c index 19688c725b..0805b21773 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -576,8 +576,6 @@ void web_server_config_options(void) web_allow_mgmt_dns = make_dns_decision(CONFIG_SECTION_WEB, "allow management by dns","heuristic",web_allow_mgmt_from); - -#ifdef NETDATA_WITH_ZLIB web_enable_gzip = config_get_boolean(CONFIG_SECTION_WEB, "enable gzip compression", web_enable_gzip); char *s = config_get(CONFIG_SECTION_WEB, "gzip compression strategy", "default"); @@ -605,7 +603,6 @@ void web_server_config_options(void) error("Invalid compression level %d. Valid levels are 1 (fastest) to 9 (best ratio). Proceeding with level 9 (best compression).", web_gzip_level); web_gzip_level = 9; } -#endif /* NETDATA_WITH_ZLIB */ } diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index db61fe3647..617f0186fa 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -176,9 +176,7 @@ extern "C" { #include <stdint.h> #endif -#ifdef NETDATA_WITH_ZLIB #include <zlib.h> -#endif #ifdef HAVE_CAPABILITY #include <sys/capability.h> diff --git a/web/server/web_client.c b/web/server/web_client.c index 8bc72e71f6..318d4ebcf8 100644 --- a/web/server/web_client.c +++ b/web/server/web_client.c @@ -8,9 +8,7 @@ int respect_web_browser_do_not_track_policy = 0; char *web_x_frame_options = NULL; -#ifdef NETDATA_WITH_ZLIB int web_enable_gzip = 1, web_gzip_level = 3, web_gzip_strategy = Z_DEFAULT_STRATEGY; -#endif /* NETDATA_WITH_ZLIB */ inline int web_client_permission_denied(struct web_client *w) { w->response.data->content_type = CT_TEXT_PLAIN; @@ -142,7 +140,6 @@ static void web_client_reset_allocations(struct web_client *w, bool free_all) { w->auth_bearer_token = NULL; // if we had enabled compression, release it -#ifdef NETDATA_WITH_ZLIB if(w->response.zinitialized) { deflateEnd(&w->response.zstream); w->response.zsent = 0; @@ -154,7 +151,6 @@ static void web_client_reset_allocations(struct web_client *w, bool free_all) { w->response.zinitialized = false; w->flags &= ~WEB_CLIENT_CHUNKED_TRANSFER; } -#endif // NETDATA_WITH_ZLIB } void web_client_request_done(struct web_client *w) { @@ -168,9 +164,7 @@ void web_client_request_done(struct web_client *w) { size_t size = (w->mode == WEB_CLIENT_MODE_FILECOPY)?w->response.rlen:w->response.data->len; size_t sent = size; -#ifdef NETDATA_WITH_ZLIB if(likely(w->response.zoutput)) sent = (size_t)w->response.zstream.total_out; -#endif // -------------------------------------------------------------------- // global statistics @@ -444,9 +438,6 @@ int mysendfile(struct web_client *w, char *filename) { } #endif - - -#ifdef NETDATA_WITH_ZLIB void web_client_enable_deflate(struct web_client *w, int gzip) { if(unlikely(w->response.zinitialized)) { debug(D_DEFLATE, "%llu: Compression has already be initialized for this client.", w->id); @@ -492,7 +483,6 @@ void web_client_enable_deflate(struct web_client *w, int gzip) { debug(D_DEFLATE, "%llu: Initialized compression.", w->id); } -#endif // NETDATA_WITH_ZLIB void buffer_data_options2string(BUFFER *wb, uint32_t options) { int count = 0; @@ -730,16 +720,12 @@ const char *web_response_code_to_string(int code) { static inline char *http_header_parse(struct web_client *w, char *s, int parse_useragent) { static uint32_t hash_origin = 0, hash_connection = 0, hash_donottrack = 0, hash_useragent = 0, hash_authorization = 0, hash_host = 0, hash_forwarded_proto = 0, hash_forwarded_host = 0; -#ifdef NETDATA_WITH_ZLIB static uint32_t hash_accept_encoding = 0; -#endif if(unlikely(!hash_origin)) { hash_origin = simple_uhash("Origin"); hash_connection = simple_uhash("Connection"); -#ifdef NETDATA_WITH_ZLIB hash_accept_encoding = simple_uhash("Accept-Encoding"); -#endif hash_donottrack = simple_uhash("DNT"); hash_useragent = simple_uhash("User-Agent"); hash_authorization = simple_uhash("X-Auth-Token"); @@ -798,7 +784,6 @@ static inline char *http_header_parse(struct web_client *w, char *s, int parse_u strncpyz(buffer, v, ((size_t)(ve - v) < sizeof(buffer) - 1 ? (size_t)(ve - v) : sizeof(buffer) - 1)); w->server_host = strdupz(buffer); } -#ifdef NETDATA_WITH_ZLIB else if(hash == hash_accept_encoding && !strcasecmp(s, "Accept-Encoding")) { if(web_enable_gzip) { if(strcasestr(v, "gzip")) @@ -809,7 +794,6 @@ static inline char *http_header_parse(struct web_client *w, char *s, int parse_u // web_client_enable_deflate(w, 0); } } -#endif /* NETDATA_WITH_ZLIB */ #ifdef ENABLE_HTTPS else if(hash == hash_forwarded_proto && !strcasecmp(s, "X-Forwarded-Proto")) { if(strcasestr(v, "https")) @@ -1736,7 +1720,6 @@ ssize_t web_client_send_chunk_finalize(struct web_client *w) return bytes; } -#ifdef NETDATA_WITH_ZLIB ssize_t web_client_send_deflate(struct web_client *w) { ssize_t len = 0, t = 0; @@ -1851,12 +1834,9 @@ ssize_t web_client_send_deflate(struct web_client *w) return(len); } -#endif // NETDATA_WITH_ZLIB ssize_t web_client_send(struct web_client *w) { -#ifdef NETDATA_WITH_ZLIB if(likely(w->response.zoutput)) return web_client_send_deflate(w); -#endif // NETDATA_WITH_ZLIB ssize_t bytes; diff --git a/web/server/web_client.h b/web/server/web_client.h index f43d9c5ce0..dcb127a322 100644 --- a/web/server/web_client.h +++ b/web/server/web_client.h @@ -5,9 +5,7 @@ #include "libnetdata/libnetdata.h" -#ifdef NETDATA_WITH_ZLIB extern int web_enable_gzip, web_gzip_level, web_gzip_strategy; -#endif /* NETDATA_WITH_ZLIB */ #define HTTP_REQ_MAX_HEADER_FETCH_TRIES 100 @@ -121,13 +119,11 @@ struct response { bool zoutput; // if set to 1, web_client_send() will send compressed data -#ifdef NETDATA_WITH_ZLIB bool zinitialized; z_stream zstream; // zlib stream for sending compressed output to client size_t zsent; // the compressed bytes we have sent to the client size_t zhave; // the compressed bytes that we have received from zlib Bytef zbuffer[NETDATA_WEB_RESPONSE_ZLIB_CHUNK_SIZE]; // temporary buffer for storing compressed output -#endif /* NETDATA_WITH_ZLIB */ }; struct web_client; |