Skip to content

fksvs/mhttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MHTTP - Minimal HTTPS web server

mhttp is a epoll based minimal HTTPS web server.

Table of Contents

  1. Features
  2. Requirements
  3. Installation
  4. Usage
  5. Caveats
  6. License

Features

  • Support for both IPv4 and IPv6.
  • Multi-client architecture.
  • GET and HEAD methods.
  • Detailed error codes.
  • Custom logging.

Requirements

  • OpenSSL

Installation

git clone https://github.com/fksvs/mhttp
git clone https://gitlab.com/fksvs/mhttp
  • navigate to the mhttp directory and build the source code:
cd mhttp/
make
  • to enable debug features (console logging), build with debug flag:
make debug

Usage

Run mhttp with the following command:

./mhttp [options]

mhttp will then start as daemon.

The server will listen on addresses specified as macro in the src/types.h file. Make sure to configure these macros before compiling or use -a, -p and -6 options according to your requirements.

To enable TLS, generate a certificate and key file. Default file names are cert.pem and key.pem

Options:

  • -a [listen address] : listen address for incoming connection
  • -p [listen port] : listen port for incoming connections
  • -6 : use IPv6
  • -d [directory] : main directory to serve
  • -s : use TLS
  • -c [certificate file] : TLS certificate file
  • -k [key file] : TLS private key file
  • -f [log file] : set log file
  • -h : display this help

Caveats

I developed this web server for fun, many lines of code in this project is probably vulnerable.

License

This project is free software; you can redistribute it and/or modify it under the terms of the GPLv3 license. See LICENSE for details.