diff options
author | June McEnroe <june@causal.agency> | 2020-07-09 20:39:38 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-09 20:39:38 -0400 |
commit | ec20355dfdcf27f43a7341d225edddd605a3ba7c (patch) | |
tree | 5ee822c7d27a800bb8e717af120f8ee7d42c1344 /server.h | |
parent | Implement very basic events listing (diff) | |
download | scooper-ec20355dfdcf27f43a7341d225edddd605a3ba7c.tar.gz scooper-ec20355dfdcf27f43a7341d225edddd605a3ba7c.zip |
Add before param in redirect
Diffstat (limited to '')
-rw-r--r-- | server.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server.h b/server.h index 0e77f7c..b1a22ee 100644 --- a/server.h +++ b/server.h @@ -121,6 +121,14 @@ httpHead(struct kreq *req, enum khttp http, enum kmime mime) { || khttp_head(req, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[mime]); } +static inline enum kcgi_err +httpRedirect(struct kreq *req, const char *url) { + return httpHead(req, KHTTP_302, KMIME_TEXT_PLAIN) + || khttp_head(req, kresps[KRESP_LOCATION], "%s", url) + || khttp_body(req) + || khttp_printf(req, "%s\n", url); +} + static inline enum kcgi_err httpFail(struct kreq *req, enum khttp http) { return httpHead(req, http, KMIME_TEXT_PLAIN) || khttp_body(req) |