← Winnitude! Search  ·  Reader Mode (1220 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 61 LINKS

GitHub - RamseyK/httpserver: A high performance, single threaded, HTTP/1.1 server written in C++23 using BSD kqueue for socket event notification

Repository navigation

httpserver
Public

About

A high performance, single threaded, HTTP/1.1 server written in C++23 using BSD kqueue for socket event notification

Topics

c-plus-plus cpp23 darwin freebsd http http-server httpd kqueue server socket-programming sockets

Resources

Readme Apache-2.0 license Activity

Stars

84 stars

Watchers

7 watching

Forks

32 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


141 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.github/ workflows .github/ workflows    
bin bin    
src src    
.gitignore .gitignore    
LICENSE LICENSE    
Makefile Makefile    
README.md README.md    
compile_flags.txt compile_flags.txt    

Repository files navigation

HTTP Server

A high-performance, single-threaded, event-driven HTTP/1.1 server written in C++23, built on kqueue. Intended as a learning tool for kqueue-based socket management and the HTTP/1.1 protocol on BSD systems.

Features

  • Efficient event-driven I/O via kqueue
  • Optional privilege dropping (drop_uid / drop_gid) after binding
  • Self-contained HTTP/1.1 parser built on the ByteBuffer library
  • Clean, documented code
  • Tested on FreeBSD and macOS

Requirements

  • A BSD-based system (FreeBSD, macOS) -- Linux may work via libkqueue
  • A C++23-capable clang compiler
  • make on macOS; gmake on FreeBSD

Quick start

git clone https://github.com/RamseyK/httpserver.git
cd httpserver
make                       # produces ./bin/httpserver
mkdir htdocs               # document root
$EDITOR server.config      # see Configuration below
./bin/httpserver

Configuration

server.config is read from the working directory. Lines starting with # are ignored. Format: key=value, one per line.

Key Required Description
vhost yes Comma-separated list of host aliases to serve
port yes TCP port (1-65535)
diskpath yes Path to document root (must exist)
drop_uid no UID to drop to after binding (must be set with drop_gid)
drop_gid no GID to drop to after binding (must be set with drop_uid)

Example

$ cat server.config
vhost=10.0.10.86,acme.local
port=8080
diskpath=./htdocs

$ ./bin/httpserver
Primary port: 8080, disk path: ./htdocs
vhost: 10.0.10.86
vhost: acme.local
Server ready. Listening on port 8080...

License

Apache License v2.0. See LICENSE file.


Ramsey Kant -- https://github.com/RamseyK/httpserver

About

A high performance, single threaded, HTTP/1.1 server written in C++23 using BSD kqueue for socket event notification

Topics

c-plus-plus cpp23 darwin freebsd http http-server httpd kqueue server socket-programming sockets

Resources

Readme Apache-2.0 license Activity

Stars

84 stars

Watchers

7 watching

Forks

32 forks Report repository

Releases

Contributors

Languages