diff options
-rw-r--r-- | main.ha | 10 | ||||
-rw-r--r-- | req.ha | 13 |
2 files changed, 13 insertions, 10 deletions
@@ -3,7 +3,6 @@ // Adapted from template by Willow Barraco <contact@willowbarraco.fr> use getopt; -use htmpl; use log; use net; use net::dial; @@ -16,7 +15,6 @@ use memio; use io; use fmt; use bufio; -use strings; const usage: [_]getopt::help = [ "Lindenii Forge Server", @@ -60,11 +58,3 @@ export fn main() void = { }; }; }; - -export fn handlereq(conn: io::handle, request: *http::request) (void | io::error | nomem | net::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)?; -}; @@ -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)?; +}; |