web: SSL but bad

This commit is contained in:
2026-03-08 23:37:22 +01:00
parent 1f07cc38ba
commit 6315589fa1
13 changed files with 1175 additions and 804 deletions

View File

@@ -120,7 +120,9 @@ const Handler = struct {
const time_ns = self.timer.read();
const time_us_ceil = (time_ns + std.time.ns_per_us - 1) / std.time.ns_per_us;
std.log.info("{s} {s} ({} µs)", .{ @tagName(self.route.method), self.route.pathname, time_us_ceil });
const rps_floor = std.time.ns_per_s / time_ns;
std.log.info("{s} {s} (lat = {} µs, rlat = {} rps)", .{ @tagName(self.route.method), self.route.pathname, time_us_ceil, rps_floor });
self.allocator.destroy(self);
}
@@ -139,7 +141,7 @@ pub fn main() !void {
_ = ssl.c_ssl.OpenSSL_add_all_algorithms();
_ = ssl.c_ssl.SSL_load_error_strings();
const ssl_ctx = try ssl.Context.new(ssl.Method.tlsServerMethod());
const ssl_ctx = try ssl.SslContext.new(.tlsServerMethod());
defer ssl_ctx.free();
_ = ssl_ctx.setMinProtoVersion(ssl.c_ssl.TLS1_3_VERSION);
@@ -152,6 +154,7 @@ pub fn main() !void {
var server = try web.Server.init(allocator, .{
.request_router = router.interface(),
.address = .initIp4(.{ 127, 0, 0, 1 }, 8000),
.ssl_ctx = ssl_ctx,
});
defer server.deinit(allocator);