summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--events.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/events.c b/events.c
index c891bff..9262225 100644
--- a/events.c
+++ b/events.c
@@ -22,5 +22,24 @@
 #include "server.h"
 
 enum kcgi_err pageEvents(struct kreq *req) {
-	return httpFail(req, KHTTP_501);
+	if (!req->fieldmap[Network] || !req->fieldmap[Context]) {
+		return httpFail(req, KHTTP_404);
+	}
+
+	enum kcgi_err error = httpHead(req, KHTTP_200, KMIME_TEXT_HTML);
+	if (req->method == KMETHOD_HEAD) return error;
+
+	const char *network = req->fieldmap[Network]->parsed.s;
+	const char *context = req->fieldmap[Context]->parsed.s;
+
+	struct khtmlreq html;
+	error = error
+		|| khttp_body(req)
+		|| khtml_open(&html, req, KHTML_PRETTY)
+		|| htmlHead(&html, context)
+		|| htmlNav(&html, network, context)
+		|| htmlSearch(&html, network, context);
+	if (error) return error;
+
+	return khtml_close(&html);
 }
td>Fix tests for diff spansJune McEnroe 2021-01-20Avoid matching ':' in make tagsJune McEnroe 2021-01-19Prefer tag matches not preceded by [[:alnum:]]June McEnroe 2021-01-19Escape \ and / in mtags search patternsJune McEnroe 2021-01-20Use mtags in source-filterJune McEnroe 2021-01-19Add mtags to generate tags for make and mdocJune McEnroe 2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe 2021-01-19Don't use a pager if reading standard inputJune McEnroe 2021-01-19Support BSD make syntax and match *.amJune McEnroe 2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe 2021-01-18Allow matching lexers using first input lineJune McEnroe