summary refs log tree commit diff
path: root/server.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-13 18:14:22 -0400
committerJune McEnroe <june@causal.agency>2020-07-13 18:14:22 -0400
commitc1dfd0bb139f58a9f34dbfc61920b59df00c70c1 (patch)
tree47163cbba95f5e850179a0a8b78e9a00f2ea9c7c /server.c
parentAdd room to start selecting table rows (diff)
downloadscooper-c1dfd0bb139f58a9f34dbfc61920b59df00c70c1.tar.gz
scooper-c1dfd0bb139f58a9f34dbfc61920b59df00c70c1.zip
Incorporate CSS into C without file2c
It's a shame file2c is not available everywhere.
Diffstat (limited to 'server.c')
-rw-r--r--server.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/server.c b/server.c
index bc05299..c384020 100644
--- a/server.c
+++ b/server.c
@@ -21,6 +21,7 @@
 #include <sysexits.h>
 #include <unistd.h>
 
+#include "css.h"
 #include "server.h"
 
 sqlite3 *db;
@@ -51,15 +52,13 @@ const struct kvalid Keys[KeysLen] = {
 #undef X
 };
 
-static const char CSS[] = {
-#include "default.css.h"
-};
-static const char *Cache = "public, max-age=86400, immutable";
-
 static enum kcgi_err stylesheet(struct kreq *req) {
 	if (req->mime != KMIME_TEXT_CSS) return httpFail(req, KHTTP_404);
 	return httpHead(req, KHTTP_200, KMIME_TEXT_CSS)
-		|| khttp_head(req, kresps[KRESP_CACHE_CONTROL], "%s", Cache)
+		|| khttp_head(
+			req, kresps[KRESP_CACHE_CONTROL],
+			"public, max-age=86400, immutable"
+		)
 		|| khttp_body(req)
 		|| khttp_write(req, CSS, sizeof(CSS));
 }