No description
Find a file
2017-05-27 09:07:13 +02:00
tests Finished query string parsing implementation (PR #109) 2017-05-27 09:07:13 +02:00
web Added default GET-example 2014-07-11 12:43:58 +02:00
.gitignore Added crypto.hpp for convenient C++ wrappings for commonly used OpenSSL functions 2016-12-20 12:21:38 +01:00
.travis.yml Added CI 2016-08-03 11:57:40 +02:00
client_http.hpp Fixed #112: Client now supports Connection: close responses without Content-Length and Transfer-Encoding. Also supports HTTP 1.0 responses that does not specify content length 2017-02-24 19:16:15 +01:00
client_https.hpp Fixes #101: added Config::timeout_connect 2017-01-21 10:22:27 +01:00
CMakeLists.txt oups forgot to link to openssl 2016-12-20 22:18:00 +01:00
crypto.hpp Added stream versions of the Crypto:: hash functions for calculating hashes from for instance large files 2016-12-21 10:07:22 +01:00
http_examples.cpp Cleanup of server-constructors. Previous constructors have been marked as deprecated. 2016-12-29 09:53:58 +01:00
https_examples.cpp Cleanup of server-constructors. Previous constructors have been marked as deprecated. 2016-12-29 09:53:58 +01:00
LICENSE Updated copyright year in LICENSE 2016-07-01 09:26:44 +02:00
README.md Fix broken Markdown headings 2017-04-18 00:47:03 -03:00
server_http.hpp Finished query string parsing implementation (PR #109) 2017-05-27 09:07:13 +02:00
server_https.hpp Minor SocketServer<WSS> constructor cleanup 2016-12-30 10:44:10 +01:00

Simple-Web-Server Build Status

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

See https://github.com/eidheim/Simple-WebSocket-Server for an easy way to make WebSocket/WebSocket Secure endpoints in C++. Also, feel free to check out the new C++ IDE supporting C++11/14/17: https://github.com/cppit/jucipp.

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 C++ libraries
  • 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/