vanilla_http_server.http_server #
Constants #
const tiny_bad_request_response = 'HTTP/1.1 400 Bad Request\r\nContent-Length: 0\r\nConnection: close\r\n\r\n'.bytes()
struct Server #
struct Server {
pub:
port int = 3000
pub mut:
socket_fd int
epoll_fds []int = []int{len: max_thread_pool_size, cap: max_thread_pool_size}
threads []thread = []thread{len: max_thread_pool_size, cap: max_thread_pool_size}
request_handler fn ([]u8, int) ![]u8 @[required]
}
fn (Server) run #
fn (mut server Server) run()
run starts the HTTP server and handles incoming connections. This method uses epoll for efficient event-driven I/O handling.