]> arthur.barton.de Git - netdata.git/commitdiff
added config file option to disable web gzip compression
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 15 Oct 2015 19:55:22 +0000 (22:55 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 15 Oct 2015 19:55:22 +0000 (22:55 +0300)
src/log.h
src/main.c
src/web_client.c
src/web_client.h
src/web_server.c

index 5e6fe1b06ef00827f16f785b8f10e670699cce77..d9868c61f91b6d97f6c9b48c07000da488e7a338 100755 (executable)
--- a/src/log.h
+++ b/src/log.h
@@ -25,9 +25,9 @@
 #define D_DICTIONARY           0x00040000
 #define D_MEMORY                       0x00080000
 
-#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS)
+//#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS)
 //#define DEBUG 0xffffffff
-//#define DEBUG (0)
+#define DEBUG (0)
 
 extern unsigned long long debug_flags;
 
index 2f4e2a91cb50ed4e1c5ffd3b3eaf69a8c7792a18..0fb0f0d9b7507a8a29475bb6f9609f5fee5458dc 100755 (executable)
@@ -220,7 +220,7 @@ int main(int argc, char **argv)
                        fprintf(stderr, "  -u USERNAME can be any system username to run as. Default: none.\n");
                        fprintf(stderr, "  -ch path to access host /proc and /sys when running in a container. Default: empty.\n");
                        fprintf(stderr, "  -nd or -nodeamon to disable forking in the background. Default: unset.\n");
-                       fprintf(stderr, "  -df FLAGS debug options. Default: 0x%8llx.\n", debug_flags);
+                       fprintf(stderr, "  -df FLAGS debug options. Default: 0x%08llx.\n", debug_flags);
                        exit(1);
                }
        }
index d9bd750b00e75e609baed436da5785f9a5f266ae..7f6a2c3486aaee7dced112992caac86981d2170c 100755 (executable)
@@ -28,7 +28,7 @@
 #define INITIAL_WEB_DATA_LENGTH 65536
 
 int web_client_timeout = DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS;
-
+int web_enable_gzip = 1;
 
 struct web_client *web_clients = NULL;
 unsigned long long web_clients_count = 0;
@@ -540,7 +540,7 @@ void web_client_process(struct web_client *w) {
                else w->keepalive = 0;
 
                // check if the client accepts deflate
-               if(strstr(w->data->buffer, "gzip"))
+               if(web_enable_gzip && strstr(w->data->buffer, "gzip"))
                        web_client_enable_deflate(w);
 
                int datasource_type = DATASOURCE_GOOGLE_JSONP;
index 76b32e2683980f4357b5ef07d59b42d7c616c467..68502a6da4274470203c1924fbefda564dfc3da3 100755 (executable)
@@ -10,6 +10,7 @@
 
 #define DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS 60
 extern int web_client_timeout;
+extern int web_enable_gzip;
 
 #ifndef NETDATA_WEB_CLIENT_H
 #define NETDATA_WEB_CLIENT_H 1
index 4133f40502a0a5c369e0893055b09a713343384f..b772be601991c4e6cee91e8195649b8925758973 100755 (executable)
@@ -148,6 +148,7 @@ void *socket_listen_main(void *ptr)
                error("Cannot set pthread cancel state to ENABLE.");
 
        web_client_timeout = config_get_number("global", "disconnect idle web clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
+       web_enable_gzip = config_get_boolean("global", "enable web responses gzip compression", web_enable_gzip);
 
        if(listen_fd < 0) fatal("LISTENER: Listen socket is not ready.");