A lightweight multithreaded HTTP server written in C that serves files from the current working directory.
It supports basic MIME type detection, case-insensitive file handling, and URL decoding for requested file paths.
This project is a basic HTTP server implemented using POSIX sockets and pthreads.
It listens on port 8080 and serves files located in the current directory to connected HTTP clients (e.g., browsers, curl, etc.).
Each incoming connection is handled by a separate thread, allowing for concurrent requests.
✅ Handles multiple clients using POSIX threads
✅ Supports GET requests
✅ Serves static files (HTML, text, PNG, JPEG, etc.)
✅ Automatically determines MIME types
✅ Performs case-insensitive filename matching
✅ Decodes URL-encoded file paths (e.g., %20 → space)
✅ Returns appropriate HTTP responses (200 OK, 404 Not Found)
Ensure you have a Linux or macOS environment with:
- GCC compiler
- POSIX threads (pthread)
- Basic development libraries
1.Setting up project:
git clone https://github.com/Melodictreacle/CServe.git
cd CServe
make
./server.c2.Run the project:
Then open your browser and navigate to:
http://localhost:8080/<filename>