klassmann / http-lua

HTTP Server in C for single Lua application with epoll support.

Home Page:https://lucasklassmann.com/blog/2023-02-26-more-advanced-examples-of-embedding-lua-in-c/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

http-lua

HTTP Server in C for single Lua application with epoll support.

The project is intended to be a reference for articles that I am writing for my blog. It is a small HTTP server in C that uses epoll, signalfd, and embedded Lua. The idea is to be used as a standalone application server. It can be used for study purposes, to serve as a reference, and for fun.

Articles linked to this repository

Features

  • Support basic HTTP requests and responses
  • Application written in Lua. Change app.lua script.
  • Event control with epoll() for signals and socket
  • Tested with 2048 clients connected per second (tested with Apache Benchmark ab)

TODO

  • Remove the fixed date time in the HTTP responses
  • Improve memory management
  • Add arguments options to
    • change port
    • max connections
    • script file
    • script entrypoint

Dependencies

- CMake >= 2.8.11
- Lua 5.3
- epoll (libc)

Building

On Linux with CMake, by default, it will use Makefile. Go inside the project's folder:

mkdir build
cd build
cmake ..
make

License

Apache 2.0

About

HTTP Server in C for single Lua application with epoll support.

https://lucasklassmann.com/blog/2023-02-26-more-advanced-examples-of-embedding-lua-in-c/

License:Apache License 2.0


Languages

Language:C 94.8%Language:Lua 3.8%Language:CMake 1.5%