diff --git a/http.c b/http.c index f7ad903..5f19687 100644 --- a/http.c +++ b/http.c @@ -128,6 +128,7 @@ int ev_handler(struct mg_connection *conn, enum mg_event ev) return MG_TRUE; case MG_REQUEST: + ctype = mg_get_header(conn, "accept"); if (ctype != NULL) fprintf(stderr, "ACCEPT: %s\n", ctype); @@ -180,6 +181,8 @@ int ev_handler(struct mg_connection *conn, enum mg_event ev) return (MG_FALSE); /* Fail it */ } + storage_init(); + /* GET */ if (!strcmp(conn->uri, "/api/me")) { push_geojson(conn); diff --git a/storage.c b/storage.c index 2f4d94d..015ffb5 100644 --- a/storage.c +++ b/storage.c @@ -26,6 +26,8 @@ void storage_init() { char path[BUFSIZ]; + setenv("TZ", "UTC", 1); + snprintf(path, BUFSIZ, "%s/ghash", STORAGEDIR); gc = gcache_open(path, TRUE); } @@ -223,7 +225,6 @@ int make_times(char *time_from, time_t *s_lo, char *time_to, time_t *s_hi) { time_t now; - setenv("TZ", "UTC", 1); // FIXME: really? time(&now); if (!time_from || !*time_from) {