1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

fixed max_clients for Simple*

This commit is contained in:
Rene Schallner 2023-01-13 18:59:53 +01:00
parent ac9af50831
commit 43dbab0278
2 changed files with 8 additions and 3 deletions

View file

@ -1,7 +1,7 @@
const std = @import("std");
const zap = @import("zap");
fn on_request(r: zap.SimpleRequest) void {
fn on_request_verbose(r: zap.SimpleRequest) void {
if (r.path) |the_path| {
std.debug.print("PATH: {s}\n", .{the_path});
}
@ -12,11 +12,16 @@ fn on_request(r: zap.SimpleRequest) void {
_ = r.sendBody("<html><body><h1>Hello from ZAP!!!</h1></body></html>");
}
fn on_request_minimal(r: zap.SimpleRequest) void {
_ = r.sendBody("<html><body><h1>Hello from ZAP!!!</h1></body></html>");
}
pub fn main() !void {
var listener = zap.SimpleHttpListener.init(.{
.port = 3000,
.on_request = on_request,
.on_request = on_request_verbose,
.log = false,
.max_clients = 100000,
});
try listener.listen();

View file

@ -110,7 +110,7 @@ pub const SimpleHttpListenerSettings = struct {
interface: [*c]const u8 = null,
on_request: ?SimpleHttpRequestFn,
public_folder: ?[]const u8 = null,
max_clients: ?u8 = null,
max_clients: ?isize = null,
timeout: ?u8 = null,
log: bool = false,
};