cookie verification using application level redirects
Costa Tsaousis committed
Jun 2, 2016 at 17:59 UTC
9461f7a274a5d4d7633a53342dcd67fa0a8ac6d1
1 file changed
+7
-2
src/web_client.c
+7
-2
@@ -991,6 +991,10 @@ int web_client_api_request_v1_registry(struct web_client *w, char *url)
991
992
redirects++;
993
994
+ registry_set_cookie(w, "give-me-back-this-cookie-please");
995
+ buffer_sprintf(w->response.data, "{ \"status\": \"redirect\", \"registry\": \"%s\" }", registry_to_announce());
996
+
997
+/*
998
char *encoded_url = url_encode(machine_url);
999
if(!encoded_url) {
1000
error("%llu: Cannot URL encode string '%s'", w->id, machine_url);
@@ -1012,13 +1016,14 @@ int web_client_api_request_v1_registry(struct web_client *w, char *url)
1016
return 500;
1017
}
1018
1015
- registry_set_cookie(w, "give-me-back-this-cookie-please");
1019
buffer_sprintf(w->response.header, "Location: %s/api/v1/registry?action=access&machine=%s&name=%s&url=%s&redirects=%d\r\n",
1020
registry_to_announce(), encoded_guid, encoded_name, encoded_url, redirects);
1021
+
1022
free(encoded_guid);
1023
free(encoded_name);
1024
free(encoded_url);
1021
- return 307;
1025
+*/
1026
+ return 200;
1027
}
1028
return registry_request_access_json(w, person_guid, machine_guid, machine_url, url_name, time(NULL));
1029