-#include <config.h>
-#include "types.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-#include <ctype.h>
-#include <stddef.h>
-
-#include "hash.h"
-#include "table.h"
-#include "client.h"
-#include "rights.h"
-#include "mem.h"
-#include "sink.h"
-#include "vector.h"
-#include "printf.h"
-#include "actions.h"
-#include "lookup.h"
-#include "url.h"
-#include "configuration.h"
-#include "cgi.h"
-#include "log.h"
-#include "queue.h"
-#include "macros.h"
-#include "macros-disorder.h"
-
-/** @brief Login cookie */
-char *login_cookie;
-
-/** @brief Return a Cookie: header */
-static char *cookie(void) {
- struct dynstr d[1];
- struct url u;
- char *s;
-
- memset(&u, 0, sizeof u);
- dynstr_init(d);
- parse_url(config->url, &u);
- if(login_cookie) {
- dynstr_append_string(d, "disorder=");
- dynstr_append_string(d, login_cookie);
- } else {
- /* Force browser to discard cookie */
- dynstr_append_string(d, "disorder=none;Max-Age=0");
- }
- if(u.path) {
- /* The default domain matches the request host, so we need not override
- * that. But the default path only goes up to the rightmost /, which would
- * cause the browser to expose the cookie to other CGI programs on the same
- * web server. */
- dynstr_append_string(d, ";Version=1;Path=");
- /* Formally we are supposed to quote the path, since it invariably has a
- * slash in it. However Safari does not parse quoted paths correctly, so
- * this won't work. Fortunately nothing else seems to care about proper
- * quoting of paths, so in practice we get with it. (See also
- * parse_cookie() where we are liberal about cookie paths on the way back
- * in.) */
- dynstr_append_string(d, u.path);
- }
- dynstr_terminate(d);
- byte_xasprintf(&s, "Set-Cookie: %s", d->vec);
- return s;
-}