added config file option to disable web gzip compression
Costa Tsaousis (ktsaou) committed
Oct 15, 2015 at 22:55 UTC
61d9f8d1f1ef24cd42c12951036aa83b8c008b15
5 files changed
+7
-5
src/log.h
+2
-2
@@ -25,9 +25,9 @@
25
#define D_DICTIONARY 0x00040000
26
#define D_MEMORY 0x00080000
27
28
-#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS)
28
+//#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS)
29
//#define DEBUG 0xffffffff
30
-//#define DEBUG (0)
30
+#define DEBUG (0)
31
32
extern unsigned long long debug_flags;
33
src/main.c
+1
-1
@@ -220,7 +220,7 @@ int main(int argc, char **argv)
220
fprintf(stderr, " -u USERNAME can be any system username to run as. Default: none.\n");
221
fprintf(stderr, " -ch path to access host /proc and /sys when running in a container. Default: empty.\n");
222
fprintf(stderr, " -nd or -nodeamon to disable forking in the background. Default: unset.\n");
223
- fprintf(stderr, " -df FLAGS debug options. Default: 0x%8llx.\n", debug_flags);
223
+ fprintf(stderr, " -df FLAGS debug options. Default: 0x%08llx.\n", debug_flags);
224
exit(1);
225
}
226
}
src/web_client.c
+2
-2
@@ -28,7 +28,7 @@
28
#define INITIAL_WEB_DATA_LENGTH 65536
29
30
int web_client_timeout = DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS;
31
-
31
+int web_enable_gzip = 1;
32
33
struct web_client *web_clients = NULL;
34
unsigned long long web_clients_count = 0;
@@ -540,7 +540,7 @@ void web_client_process(struct web_client *w) {
540
else w->keepalive = 0;
541
542
// check if the client accepts deflate
543
- if(strstr(w->data->buffer, "gzip"))
543
+ if(web_enable_gzip && strstr(w->data->buffer, "gzip"))
544
web_client_enable_deflate(w);
545
546
int datasource_type = DATASOURCE_GOOGLE_JSONP;
src/web_client.h
+1
@@ -10,6 +10,7 @@
10
11
#define DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS 60
12
extern int web_client_timeout;
13
+extern int web_enable_gzip;
14
15
#ifndef NETDATA_WEB_CLIENT_H
16
#define NETDATA_WEB_CLIENT_H 1
src/web_server.c
+1
@@ -148,6 +148,7 @@ void *socket_listen_main(void *ptr)
148
error("Cannot set pthread cancel state to ENABLE.");
149
150
web_client_timeout = config_get_number("global", "disconnect idle web clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
151
+ web_enable_gzip = config_get_boolean("global", "enable web responses gzip compression", web_enable_gzip);
152
153
if(listen_fd < 0) fatal("LISTENER: Listen socket is not ready.");
154