Skip to content

aaguy-hue/webserver67

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webserver67

A simple webserver written in C. See todo.txt for immediate priorities for what needs to be done.

Usage

Installation

  1. Install the required dependencies (see Dependencies below).
  2. Build and install:
    make
    make install
    You may need superuser privileges for make install.

Running the Server

Basic command:

ws67 [options] <website_root>

Full form:

ws67 --port <port> --config <config_path> <website_root>

Short flags: -p = --port -c = --config

Configuration Behavior

The server uses exactly one configuration file, selected in this order:

  1. Path provided via --config
  2. ./config.yml
  3. /etc/webserver67/config.yml

If none of these exist, the server runs with defaults.

Note: Configuration files are not merged. Only one is loaded.

Overrides

Command-line arguments override values from the selected config file:

--port overrides the configured port <website_root> overrides the configured root directory

All command-line arguments are optional. If omitted, values are taken entirely from the config file.

Examples

ws67
ws67 -c ./myconfig.yml # the site root can be omitted and just use the config
ws67 -p 8080 ./public
ws67 -c ./config.yml ./site

Dependencies

All of these should present on most Linux distributions except LibCYAML.

Current Capabilities

  • Receives HTTP requests
    • Processes control data (i.e. first line)
    • Processes a limited set of request headers
  • Serve static files over HTTP
    • Can serve many common filetypes used on the web
  • Directory browsing
  • Reads YAML config files
    • Can receive overrides from command line arguments

Planned Capabilities

  • Read requests of unlimited size
  • Chunked transfer coding in responses (not requests)
  • Process more types of request headers
  • Reverse proxy
  • Allow subdirectories to have their own index.html files

Limitations

  • Only supports HTTP/1.1
    • Things like processing control data become more annoying in later versions
  • Only supports unix systems
    • Socket-related functions are in different headers on windows
    • Relies on unistd.h and time.h, unistd is unix-specific and time functions are different on windows
  • Does not support chunked transfer coding
    • Assumes content is just one giant blob sent with the request

About

A simple HTTP/1.1 webserver written in C for unix systems.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages