Simple-Web-Server-master
所属分类:源码/资料
开发工具:C/C++
文件大小:39KB
下载次数:9
上传日期:2018-12-27 12:13:36
上 传 者:
ericsraul
说明: 简单的http库,包括服务端和客户端,底层用boost::asio
(simple http lib, server & client which network protocol use boost::asio)
文件列表:
.clang-format (222, 2018-06-12)
.travis.yml (642, 2018-06-12)
CMakeLists.txt (3114, 2018-06-12)
LICENSE (1093, 2018-06-12)
client_http.hpp (28914, 2018-06-12)
client_https.hpp (6514, 2018-06-12)
crypto.hpp (8286, 2018-06-12)
http_examples.cpp (9096, 2018-06-12)
https_examples.cpp (9201, 2018-06-12)
server_http.hpp (29703, 2018-06-12)
server_https.hpp (3038, 2018-06-12)
status_code.hpp (8016, 2018-06-12)
tests (0, 2018-06-12)
tests\CMakeLists.txt (660, 2018-06-12)
tests\crypto_test.cpp (3826, 2018-06-12)
tests\io_test.cpp (15097, 2018-06-12)
tests\parse_test.cpp (11859, 2018-06-12)
tests\status_code_test.cpp (1576, 2018-06-12)
utility.hpp (12219, 2018-06-12)
web (0, 2018-06-12)
web\index.html (154, 2018-06-12)
web\test.html (153, 2018-06-12)
**_This project has moved to https://gitlab.com/eidheim/Simple-Web-Server._**
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.
See https://gitlab.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://gitlab.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.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:
```sh
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/
近期下载者:
相关文件:
收藏者: