summaryrefslogtreecommitdiffstats
path: root/src/web_client.c
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-05-14 18:49:36 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-05-14 18:49:36 +0300
commitf1647aa7167a8235fed3dff56fe2c741410d075a (patch)
treeb4ca8c72dab30f63a1646129fcb997f5c6dd9e2f /src/web_client.c
parent63696cf075bf2577e8447c297e6a803e5b8cb4d0 (diff)
registry responds with both domain and host cookies; registry uses snprintfz, strncpyz
Diffstat (limited to 'src/web_client.c')
-rw-r--r--src/web_client.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/web_client.c b/src/web_client.c
index 39cabdf000..601dda083a 100644
--- a/src/web_client.c
+++ b/src/web_client.c
@@ -175,7 +175,8 @@ void web_client_reset(struct web_client *w)
}
w->last_url[0] = '\0';
- w->cookie[0] = '\0';
+ w->cookie1[0] = '\0';
+ w->cookie2[0] = '\0';
w->origin[0] = '*';
w->origin[1] = '\0';
@@ -801,6 +802,9 @@ int web_client_api_request_v1_registry(struct web_client *w, char *url)
debug(D_WEB_CLIENT, "%llu: API v1 registry with URL '%s'", w->id, url);
+ // FIXME
+ // The browser may send multiple cookies with our id
+
char *cookie = strstr(w->response.data->buffer, " " NETDATA_REGISTRY_COOKIE_NAME "=");
if(cookie)
strncpyz(person_guid, &cookie[sizeof(NETDATA_REGISTRY_COOKIE_NAME) + 1], 36);
@@ -1655,10 +1659,16 @@ void web_client_process(struct web_client *w) {
, date
);
- if(w->cookie[0]) {
+ if(w->cookie1[0]) {
+ buffer_sprintf(w->response.header_output,
+ "Set-Cookie: %s\r\n",
+ w->cookie1);
+ }
+
+ if(w->cookie2[0]) {
buffer_sprintf(w->response.header_output,
"Set-Cookie: %s\r\n",
- w->cookie);
+ w->cookie2);
}
if(w->mode == WEB_CLIENT_MODE_OPTIONS) {