Skip to content

Melodictreacle/CServe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖥️ Simple Multithreaded HTTP File Server in C

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.


🚀 Introduction

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.


✨ Features

✅ 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)


⚙️ Installation

Prerequisites

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.c

2.Run the project:

Then open your browser and navigate to:

  http://localhost:8080/<filename>
   

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors