Skip to content

A simple HTTP server written in C using UNIX sockets. Supports GET and HEAD requests.

Notifications You must be signed in to change notification settings

ketanhwr/http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Server Build Status

A simple HTTP server written in C using UNIX sockets. Supports GET and HEAD requests.

Instructions

  1. Install make.

  2. Clone this repository using this command:

    git clone https://github.com/ketanhwr/http-server.git
    
  3. Run make:

    make
    
  4. Run the server:

    [sudo] ./http-server
    
  5. Open your web browser and head on to

    localhost:10000
    

Features

  • Supports GET and HEAD requests.
  • Looks for the file index.html in the current directory and serves it if found.
  • Returns Status Codes 200 (OK), 400 (Bad Request) and 404 (Not Found)

TODOs

  • Serving multiple clients at once using multi-threading.
  • Adding option to change ROOT directory and PORT number by passing them as arguments.
  • Show image files (.jpg/.png) files as well when opened.

About

A simple HTTP server written in C using UNIX sockets. Supports GET and HEAD requests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published