aboutsummaryrefslogtreecommitdiff
path: root/req.ha
blob: c307332e4cfb44a5b0e5b542adccfe774cc88339 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>

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)?;
};