@cryptotaxi247 / netdata-1 / commits / 77c185950

Revert "URL_parser fixing allmetrics! (#6231)"

This reverts commit 1c60c6eb8749c80acf5262253963d9d08f0d468e. -- As agreed with @thiago and @cakrit we revert URL parser changes, to buy the time on a more detailed investigation --

Pavlos Emm. Katsoulakis committed Jun 7, 2019 at 18:13 UTC 77c1859506a0488993a98c5623937015928fde05
1 file changed +3 -27
web/api/exporters/allmetrics.c
+3 -27
@@ -26,21 +26,13 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
26 const char *prometheus_prefix = global_backend_prefix;
27
28 uint32_t end = w->total_params;
29 - uint32_t i;
30 - char sname[WEB_FIELDS_MAX];
31 - char svalue[WEB_FIELDS_MAX];
29 if (end) {
33 - i = 0;
30 + uint32_t i = 0;
31 do {
32 char *name = w->param_name[i].body;
33 size_t lname = w->param_name[i].length;
37 - sname[i] = name[lname];
38 - name[lname] = 0x00;
39 -
34 char *value = w->param_values[i].body;
35 size_t lvalue = w->param_values[i].length;
42 - svalue[i] = value[lvalue];
43 - value[lvalue] = 0x00;
36
37 if(!strncmp(name, "format",lname)) {
38 if(!strncmp(value, ALLMETRICS_FORMAT_SHELL,lvalue))
@@ -82,7 +74,6 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
74 buffer_flush(w->response.data);
75 buffer_no_cacheable(w->response.data);
76
85 - int ret;
77 switch(format) {
78 case ALLMETRICS_JSON:
79 w->response.data->contenttype = CT_APPLICATION_JSON;
@@ -104,8 +95,7 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
95 , prometheus_backend_options
96 , prometheus_output_options
97 );
107 - ret = 200;
108 - break;
98 + return 200;
99
100 case ALLMETRICS_PROMETHEUS_ALL_HOSTS:
101 w->response.data->contenttype = CT_PROMETHEUS;
@@ -117,25 +107,11 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
107 , prometheus_backend_options
108 , prometheus_output_options
109 );
120 - ret = 200;
121 - break;
110 + return 200;
111
112 default:
113 w->response.data->contenttype = CT_TEXT_PLAIN;
114 buffer_strcat(w->response.data, "Which format? '" ALLMETRICS_FORMAT_SHELL "', '" ALLMETRICS_FORMAT_PROMETHEUS "', '" ALLMETRICS_FORMAT_PROMETHEUS_ALL_HOSTS "' and '" ALLMETRICS_FORMAT_JSON "' are currently supported.");
115 return 400;
116 }
128 -
129 - i = 0;
130 - do {
131 - char *name = w->param_name[i].body;
132 - size_t lname = w->param_name[i].length;
133 - name[lname] = sname[i];
134 -
135 - char *value = w->param_values[i].body;
136 - size_t lvalue = w->param_values[i].length;
137 - value[lvalue] = svalue[i];
138 - } while( ++i < end);
139 -
140 - return ret;
117 }