From: Costa Tsaousis (ktsaou) Date: Wed, 22 Feb 2017 22:19:06 +0000 (+0200) Subject: log all accesses to the STREAM API X-Git-Tag: ab-debian_0.20170227.01-0ab1~1^2~14^2~40 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;ds=sidebyside;h=46c64967e7f54a9b3b8769ecffc9106977f63cb7;hp=f1fed11619c1a4afeeb7ddda81f5ee6526a37bd4;p=netdata.git log all accesses to the STREAM API --- diff --git a/src/web_client.c b/src/web_client.c index 7c5474ed..ff66eb5c 100644 --- a/src/web_client.c +++ b/src/web_client.c @@ -1673,6 +1673,8 @@ int validate_stream_api_key(const char *key) { } int web_client_stream_request(RRDHOST *host, struct web_client *w, char *url) { + info("STREAM [%s]:%s: client connection.", w->client_ip, w->client_port); + char *key = NULL, *hostname = NULL, *machine_guid = NULL, *os = NULL; int update_every = default_rrd_update_every; int history = default_rrd_history_entries; @@ -2481,18 +2483,23 @@ void web_client_process_request(struct web_client *w) { switch(http_request_validate(w)) { case HTTP_VALIDATION_OK: - if(unlikely(w->mode == WEB_CLIENT_MODE_OPTIONS)) { - w->response.data->contenttype = CT_TEXT_PLAIN; - buffer_flush(w->response.data); - buffer_strcat(w->response.data, "OK"); - w->response.code = 200; - } - else if(unlikely(w->mode == WEB_CLIENT_MODE_STREAM)) { - w->response.code = web_client_stream_request(localhost, w, w->decoded_url); - return; + switch(w->mode) { + case WEB_CLIENT_MODE_STREAM: + w->response.code = web_client_stream_request(localhost, w, w->decoded_url); + return; + + case WEB_CLIENT_MODE_OPTIONS: + w->response.data->contenttype = CT_TEXT_PLAIN; + buffer_flush(w->response.data); + buffer_strcat(w->response.data, "OK"); + w->response.code = 200; + break; + + case WEB_CLIENT_MODE_FILECOPY: + case WEB_CLIENT_MODE_NORMAL: + w->response.code = web_client_process_url(localhost, w, w->decoded_url); + break; } - else - w->response.code = web_client_process_url(localhost, w, w->decoded_url); break; case HTTP_VALIDATION_INCOMPLETE: