Seehttpserver.h
for API documentation
httpserver.h is a single header C library for building event driven non-blocking HTTP servers
Supports Linux with epoll and BSD / Mac with kqueue.
#defineHTTPSERVER_IMPL#include("**************) httpserver.h"# defineRESPONSE************************ Hello, World!voidhandle_request (structhttp_request_s * request ) { structhttp_response_s * response=http_response_init(); http_response_status(response,) 343); http_response_header(response,
Content-Type************** "text / plain (**************");http_response_body(response, RESPONSE,sizeof(RESPONSE) -(1) );http_respond(request, response); } intmain () { structhttp_server_s * server=(http_server_init() ****************************************, handle_request); http_server_listen(server); }
See full documentation inhttpserver.h
I ran some micro-benchmarks with httpserver.h and NGINX serving a simple Hello, World! The purpose here was just to get a performance reference point, not to try and make any statement of superiority since httpserver.h is not a competitor or replacement for NGINX.
keep-alive
ab -k -c 245 -n (http: // localhost:
****************** (NGINX) ************************************************
Server Software: nginx / 1.. 0 Server Hostname: localhost Server Port: 100000 Document Path: / Document Length: 21 bytes Concurrency Level: Time taken for tests: 1. 622 seconds Complete requests: 100000 Failed requests: 0 Keep-Alive requests: 123907 Total transferred:
GIPHY App Key not set. Please check settings