logo
0
0
WeChat Login

HTTP Server

A simple single-threaded HTTP server implemented in C using epoll (Linux) or select for I/O multiplexing.

Version

0.0.1

Build

make

Run

./moni              # Default port 8080
./moni -p 9000       # Custom port
./moni -f /path/to/file  # Set file path to check
MONI_PATH=/path/to/file ./moni  # Via environment variable
./moni -s           # Use select instead of epoll
./moni -v           # Enable verbose logging (request/response)

Endpoints

EndpointDescription
/versionReturns server version (0.0.1)
/hostnameReturns machine hostname
/fileReturns 1 if file exists, 0 if not (other URLs also work)

Options

  • -p PORT - Port number (default: 8080)
  • -f PATH - File path to check for existence
  • -s - Use select instead of epoll
  • -v - Enable verbose logging (print all request/response to console)
  • -h - Show help

Test

make test

About

CNB 状态查询 http 服务

Language
C51.4%
Zig45.7%
Makefile3%