Skip to content

Latest commit

 

History

History
68 lines (58 loc) · 1.95 KB

File metadata and controls

68 lines (58 loc) · 1.95 KB

Asynchronous Wed Server

Build Status

This is an Extensible Web Server Using Boost Asio Library, supporting HTTP1.1, HTTP Compression and Multi-Threading.


Usage:

Get the source code:

git clone --recursive https://github.com/HenryChen-CH/Boost-Web-Server.git

Change into the directory:

cd ./Boost-Web-Server

Compile:

make

Tips: When you just change one source file or very few files, you just need to remove the corresponding .o file, and compile again, it will greatly speed up compiling process.
Run:

./webserver <config>   

Run tests:

make test

Docker

How To Add Handler

You can conveniently add Handler extending function of the server.

  • Create your own class. Be sure using .cc .h as file extension
  • Your Handler class should inherit RequestHandler class
  • Implement all virtual functions of RequestHandler class
  • call REGISTER_REQUEST_HANDLER(YourClassName) in header file
  • Configure your handler in config file
  • All Done, you can compile and run now

Config File Format

listen <port number>;   
path /path HandlerName {   
  HandlerOptions;   
}

Dependency

sudo apt-get install libboost-all-dev
sudo apt-get install zlib1g-dev

Based On:

Boost HTTP Server Example