+ if (!check_auth(username))
+ exit(0);
+
+ const char *given_token = cgi_getcookie("auth");
+ auth_logout(username, given_token);
+ respond_JSON_Success();
+ } else if (strncmp(path, "/subscribe", 10) == 0 || strncmp(path, "/unsubscribe", 12) == 0) {
+ const char *username = cgi_getentrystr("username");
+ if (!check_auth(username))
+ exit(0);
+
+ if (path[1] == 'u') {
+ if (path[12] != '/') {
+ respond_404();
+ exit(0);
+ }
+
+ ret = parse_url_info(path + 13, &info);
+ if ((ret & URL_INFO_NAME) == 0) {
+ respond_404();
+ exit(0);
+ }
+
+ subscription_remove(username, info.name);
+ } else {
+ if (path[10] != '/') {
+ respond_404();
+ exit(0);
+ }
+
+ ret = parse_url_info(path + 11, &info);
+ if ((ret & URL_INFO_NAME) == 0) {
+ respond_404();
+ exit(0);
+ }
+
+ subscription_add(username, info.name);
+ }
+ respond_JSON_Success();
+ } else if (strncmp(path, "/feed", 6) == 0) {
+ const char *username = cgi_getentrystr("username");
+ if (!check_auth(username))