diff options
author | June McEnroe <june@causal.agency> | 2020-07-16 14:35:15 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-16 14:35:15 -0400 |
commit | d1a846d5887bf72ca6133b8bbaeea35e8e980b55 (patch) | |
tree | 83078e8af6cd829d9adf649ffd267a2bb0b7b901 | |
parent | Factor out search page URLs (diff) | |
download | scooper-d1a846d5887bf72ca6133b8bbaeea35e8e980b55.tar.gz scooper-d1a846d5887bf72ca6133b8bbaeea35e8e980b55.zip |
Handle HEAD for stylesheet
Diffstat (limited to '')
-rw-r--r-- | server.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server.c b/server.c index 0ed1c9c..96acad7 100644 --- a/server.c +++ b/server.c @@ -54,13 +54,15 @@ const struct kvalid Keys[KeysLen] = { 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) + enum kcgi_err error = 0 + || httpHead(req, KHTTP_200, KMIME_TEXT_CSS) || khttp_head( req, kresps[KRESP_CACHE_CONTROL], "public, max-age=86400, immutable" ) - || khttp_body(req) - || khttp_write(req, CSS, sizeof(CSS)); + || khttp_body(req); + if (req->method == KMETHOD_HEAD) return error; + return error || khttp_write(req, CSS, sizeof(CSS)); } static enum kcgi_err dispatch(struct kreq *req) { |