Skip to content

It a Web Server capable of hosting basic web pages wriiten purely in C++.

License

Notifications You must be signed in to change notification settings

alekhgupta1441/Web_Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b960154 · Mar 21, 2020

History

12 Commits
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020
Mar 21, 2020

Repository files navigation

Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Asio (both Boost.Asio and standalone Asio can be used). Created to be an easy way to make REST resources available from C++ applications.

Features

  • Asynchronous request handling
  • Thread pool if needed
  • Platform independent
  • HTTPS support
  • HTTP persistent connection (for HTTP/1.1)
  • Client supports chunked transfer encoding
  • Timeouts, if any of Server::timeout_request and Server::timeout_content are >0 (default: Server::timeout_request=5 seconds, and Server::timeout_content=300 seconds)
  • Simple way to add REST resources using regex for path, and anonymous functions

Usage

See http_examples.cpp or https_examples.cpp for example usage.

See particularly the JSON-POST (using Boost.PropertyTree) and the GET /match/[number] examples, which are most relevant.

Dependencies

  • Boost.Asio or standalone Asio
  • Boost is required to compile the examples
  • For HTTPS: OpenSSL libraries

Compile and run

Compile with a C++11 compliant compiler:

mkdir build
cd build
cmake ..
make
cd ..

HTTP

Run the server and client examples: ./build/http_examples

Direct your favorite browser to for instance http://localhost:8080/

HTTPS

Before running the server, an RSA private key (server.key) and an SSL certificate (server.crt) must be created. Follow, for instance, the instructions given here (for a self-signed certificate): http://www.akadia.com/services/ssh_test_certificate.html

Run the server and client examples: ./build/https_examples

Direct your favorite browser to for instance https://localhost:8080/

About

It a Web Server capable of hosting basic web pages wriiten purely in C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published