@cryptotaxi247 / netdata-1 / commits / 866210458

registry: prevent error log when users are redirected to verify their browser supports cookies

Costa Tsaousis (ktsaou) committed Sep 4, 2016 at 14:41 UTC 866210458e93f27f0a95dd6eb82f574c24729987
1 file changed +8 -2
src/web_client.c
+8 -2
@@ -1145,6 +1145,9 @@ cleanup:
1145 return ret;
1146 }
1147
1148 +
1149 +#define REGISTRY_VERIFY_COOKIES_GUID "give-me-back-this-cookie-now--please"
1150 +
1151 int web_client_api_request_v1_registry(struct web_client *w, char *url)
1152 {
1153 static uint32_t hash_action = 0, hash_access = 0, hash_hello = 0, hash_delete = 0, hash_search = 0,
@@ -1282,8 +1285,7 @@ int web_client_api_request_v1_registry(struct web_client *w, char *url)
1285 w->tracking_required = 1;
1286 if(registry_verify_cookies_redirects() > 0 && (!cookie || !person_guid[0])) {
1287 buffer_flush(w->response.data);
1285 -
1286 - registry_set_cookie(w, "give-me-back-this-cookie-please");
1288 + registry_set_cookie(w, REGISTRY_VERIFY_COOKIES_GUID);
1289 w->response.data->contenttype = CT_APPLICATION_JSON;
1290 buffer_sprintf(w->response.data, "{ \"status\": \"redirect\", \"registry\": \"%s\" }", registry_to_announce());
1291 return 200;
@@ -1331,6 +1333,10 @@ int web_client_api_request_v1_registry(struct web_client *w, char *url)
1333 return 307
1334 */
1335 }
1336 +
1337 + if(unlikely(cookie && person_guid[0] && !strcmp(person_guid, REGISTRY_VERIFY_COOKIES_GUID)))
1338 + person_guid[0] = '\0';
1339 +
1340 return registry_request_access_json(w, person_guid, machine_guid, machine_url, url_name, time(NULL));
1341
1342 case 'D':