A multithreaded HTTP/1.1 file server written in C. [Supports GET, HEAD, If-Modified-Since requests]
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Makefile
README.md
TODO.txt
constants.h
encoding_prefs.c
encoding_prefs.h
files.c
files.h
http.c
http.h
http_server.c
test_encoding_prefs.c
test_url.c
test_util.c
threaded_server.c
threaded_server.h
timestamp.c
timestamp.h
url.c
url.h
util.c
util.h

README.md

classic_http_server

A multithreaded HTTP/1.1 file server written in C.

Usage

./httpserver <port> serve files in the current directory on specified port.

Supported Features

  • persistent (ie: Keep-Alive) TCP connections
  • GET and HEAD requests
  • Last-Modified and If-Modified-Since headers

Future Features???

  • timeouts
  • gzip compression
  • redirects
  • POST requests (I've held off because response generation details are application specific)
  • range requests (the tricky part here will be dealing with multipart ranges)

Requirements

  • gcc, make
  • pthreads

I have tested this on Ubuntu 16.04 LTS and the Linux Subsystem for Windows. Warning: there are a few parts of the codebase that make use of nonstandard extensions in glibc ex: timegm(3).