log all accesses to the STREAM API
Costa Tsaousis (ktsaou) committed
Feb 23, 2017 at 00:19 UTC
46c64967e7f54a9b3b8769ecffc9106977f63cb7
1 file changed
+18
-11
src/web_client.c
+18
-11
@@ -1673,6 +1673,8 @@ int validate_stream_api_key(const char *key) {
1673
}
1674
1675
int web_client_stream_request(RRDHOST *host, struct web_client *w, char *url) {
1676
+ info("STREAM [%s]:%s: client connection.", w->client_ip, w->client_port);
1677
+
1678
char *key = NULL, *hostname = NULL, *machine_guid = NULL, *os = NULL;
1679
int update_every = default_rrd_update_every;
1680
int history = default_rrd_history_entries;
@@ -2481,18 +2483,23 @@ void web_client_process_request(struct web_client *w) {
2483
2484
switch(http_request_validate(w)) {
2485
case HTTP_VALIDATION_OK:
2484
- if(unlikely(w->mode == WEB_CLIENT_MODE_OPTIONS)) {
2485
- w->response.data->contenttype = CT_TEXT_PLAIN;
2486
- buffer_flush(w->response.data);
2487
- buffer_strcat(w->response.data, "OK");
2488
- w->response.code = 200;
2489
- }
2490
- else if(unlikely(w->mode == WEB_CLIENT_MODE_STREAM)) {
2491
- w->response.code = web_client_stream_request(localhost, w, w->decoded_url);
2492
- return;
2486
+ switch(w->mode) {
2487
+ case WEB_CLIENT_MODE_STREAM:
2488
+ w->response.code = web_client_stream_request(localhost, w, w->decoded_url);
2489
+ return;
2490
+
2491
+ case WEB_CLIENT_MODE_OPTIONS:
2492
+ w->response.data->contenttype = CT_TEXT_PLAIN;
2493
+ buffer_flush(w->response.data);
2494
+ buffer_strcat(w->response.data, "OK");
2495
+ w->response.code = 200;
2496
+ break;
2497
+
2498
+ case WEB_CLIENT_MODE_FILECOPY:
2499
+ case WEB_CLIENT_MODE_NORMAL:
2500
+ w->response.code = web_client_process_url(localhost, w, w->decoded_url);
2501
+ break;
2502
}
2494
- else
2495
- w->response.code = web_client_process_url(localhost, w, w->decoded_url);
2503
break;
2504
2505
case HTTP_VALIDATION_INCOMPLETE: