aboutsummaryrefslogtreecommitdiff
path: root/req.ha
diff options
context:
space:
mode:
Diffstat (limited to 'req.ha')
-rw-r--r--req.ha13
1 files changed, 13 insertions, 0 deletions
diff --git a/req.ha b/req.ha
new file mode 100644
index 0000000..53e9d6a
--- /dev/null
+++ b/req.ha
@@ -0,0 +1,13 @@
+use htmpl;
+use io;
+use net::http;
+use net::uri;
+use strings;
+
+export fn handlereq(conn: io::handle, request: *http::request) (void | io::error | nomem | uri::invalid) = {
+ htmpl::write(conn, "HTTP/1.1 200 OK\r\n")?;
+ htmpl::write(conn, "Content-Type: text/html\r\n\r\n")?;
+ let segments = segments_from_path(request.target.raw_path)?;
+ defer strings::freeall(segments);
+ tp_index(conn, segments)?;
+};