1<img width="880" height = "80" alt = "Boost.Beast Title" 2 src="https://raw.githubusercontent.com/boostorg/beast/master/doc/images/readme2.png"> 3 4# HTTP and WebSocket built on Boost.Asio in C++11 5 6Branch | Linux / Windows | Coverage | Documentation | Matrix | 7----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------| 8[master](https://github.com/boostorg/beast/tree/master) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/beast/status.svg?ref=refs/heads/master)](https://drone.cpp.al/boostorg/beast) | [![codecov](https://img.shields.io/codecov/c/github/boostorg/beast/master.svg)](https://codecov.io/gh/boostorg/beast/branch/master) | [![Documentation](https://img.shields.io/badge/documentation-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/libs/beast/doc/html/index.html) | [![Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/beast.html) | 9[develop](https://github.com/boostorg/beast/tree/develop) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/beast/status.svg?ref=refs/heads/develop)](https://drone.cpp.al/boostorg/beast) | [![codecov](https://img.shields.io/codecov/c/github/boostorg/beast/develop.svg)](https://codecov.io/gh/boostorg/beast/branch/develop) | [![Documentation](https://img.shields.io/badge/documentation-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/beast/index.html) | [![Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://www.boost.org/development/tests/develop/developer/beast.html) | 10 11## Contents 12 13- [Introduction](#introduction) 14- [Appearances](#appearances) 15- [Description](#description) 16- [Requirements](#requirements) 17- [Git Branches](#branches) 18- [Building](#building) 19- [Usage](#usage) 20- [License](#license) 21- [Contact](#contact) 22- [Contributing](#contributing-we-need-your-help) 23 24## Introduction 25 26Beast is a C++ header-only library serving as a foundation for writing 27interoperable networking libraries by providing **low-level HTTP/1, 28WebSocket, and networking protocol** vocabulary types and algorithms 29using the consistent asynchronous model of Boost.Asio. 30 31This library is designed for: 32 33* **Symmetry:** Algorithms are role-agnostic; build clients, servers, or both. 34 35* **Ease of Use:** Boost.Asio users will immediately understand Beast. 36 37* **Flexibility:** Users make the important decisions such as buffer or 38 thread management. 39 40* **Performance:** Build applications handling thousands of connections or more. 41 42* **Basis for Further Abstraction.** Components are well-suited for building upon. 43 44## Appearances 45 46| <a href="https://github.com/vinniefalco/CppCon2018">CppCon 2018</a> | <a href="https://www.bishopfox.com/case_study/securing-beast/">Bishop Fox 2018</a> | 47| ------------ | ------------ | 48| <a href="https://www.youtube.com/watch?v=7FQwAjELMek"><img width="320" height = "180" alt="Beast" src="https://raw.githubusercontent.com/vinniefalco/CppCon2018/master/CppCon2018.png"></a> | <a href="https://youtu.be/4TtyYbGDAj0"><img width="320" height = "180" alt="Beast Security Review" src="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/BishopFox2018.png"></a> | 49 50| <a href="https://github.com/vinniefalco/CppCon2018">CppCon 2017</a> | <a href="http://cppcast.com/2017/01/vinnie-falco/">CppCast 2017</a> | <a href="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/CppCon2016.pdf">CppCon 2016</a> | 51| ------------ | ------------ | ----------- | 52| <a href="https://www.youtube.com/watch?v=WsUnnYEKPnI"><img width="320" height = "180" alt="Beast" src="https://raw.githubusercontent.com/vinniefalco/CppCon2017/master/CppCon2017.png"></a> | <a href="http://cppcast.com/2017/01/vinnie-falco/"><img width="180" height="180" alt="Vinnie Falco" src="https://avatars1.githubusercontent.com/u/1503976?v=3&u=76c56d989ef4c09625256662eca2775df78a16ad&s=180"></a> | <a href="https://www.youtube.com/watch?v=uJZgRcvPFwI"><img width="320" height = "180" alt="Beast" src="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/CppCon2016.png"></a> | 53 54## Description 55 56This software is in its first official release. Interfaces 57may change in response to user feedback. For recent changes 58see the [CHANGELOG](CHANGELOG.md). 59 60* [Official Site](https://github.com/boostorg/beast) 61* [Documentation](https://www.boost.org/doc/libs/master/libs/beast/) (master branch) 62* [Autobahn|Testsuite WebSocket Results](https://vinniefalco.github.io/boost/beast/reports/autobahn/index.html) 63 64## Requirements 65 66This library is for programmers familiar with Boost.Asio. Users 67who wish to use asynchronous interfaces should already know how to 68create concurrent network programs using callbacks or coroutines. 69 70* **C++11:** Robust support for most language features. 71* **Boost:** Boost.Asio and some other parts of Boost. 72* **OpenSSL:** Required for using TLS/Secure sockets and examples/tests 73 74When using Microsoft Visual C++, Visual Studio 2017 or later is required. 75 76One of these components is required in order to build the tests and examples: 77 78* Properly configured bjam/b2 79* CMake 3.5.1 or later (Windows only) 80 81## Building 82 83Beast is header-only. To use it just add the necessary `#include` line 84to your source files, like this: 85```C++ 86#include <boost/beast.hpp> 87``` 88 89If you use coroutines you'll need to link with the Boost.Coroutine 90library. Please visit the Boost documentation for instructions 91on how to do this for your particular build system. 92 93## GitHub 94 95To use the latest official release of Beast, simply obtain the latest 96Boost distribution and follow the instructions for integrating it 97into your development environment. If you wish to build the examples 98and tests, or if you wish to preview upcoming changes and features, 99it is suggested to clone the "Boost superproject" and work with Beast 100"in-tree" (meaning, the libs/beast subdirectory of the superproject). 101 102The official repository contains the following branches: 103 104* [**master**](https://github.com/boostorg/beast/tree/master) This 105 holds the most recent snapshot with code that is known to be stable. 106 107* [**develop**](https://github.com/boostorg/beast/tree/develop) This 108 holds the most recent snapshot. It may contain unstable code. 109 110Each of these branches requires a corresponding Boost branch and 111all of its subprojects. For example, if you wish to use the **master** 112branch version of Beast, you should clone the Boost superproject, 113switch to the **master** branch in the superproject and acquire 114all the Boost libraries corresponding to that branch including Beast. 115 116To clone the superproject locally, and switch into the main project's 117directory use: 118``` 119git clone --recursive https://github.com/boostorg/boost.git 120cd boost 121``` 122 123"bjam" is used to build Beast and the Boost libraries. On a non-Windows 124system use this command to build bjam: 125``` 126./bootstrap.sh 127``` 128 129From a Windows command line, build bjam using this command: 130``` 131.\BOOTSTRAP.BAT 132``` 133 134## Building tests and examples 135Building tests and examples requires OpenSSL installed. If OpenSSL is installed 136in a non-system location, you will need to copy the 137[user-config.jam](tools/user-config.jam) file into your home directory and set 138the `OPENSSL_ROOT` environment variable to the path that contains an installation 139of OpenSSL. 140 141### Ubuntu/Debian 142If installed into a system directory, OpenSSL will be automatically found and used. 143```bash 144sudo apt install libssl-dev 145``` 146### Windows 147Replace `path` in the following code snippets with the path you installed vcpkg 148to. Examples assume a 32-bit build, if you build a 64-bit version replace 149`x32-windows` with `x64-windows` in the path. 150- Using [vcpkg](https://github.com/Microsoft/vcpkg) and CMD: 151```bat 152vcpkg install openssl --triplet x32-windows 153SET OPENSSL_ROOT=path\installed\x32-windows 154``` 155 156- Using [vcpkg](https://github.com/Microsoft/vcpkg) and PowerShell: 157```powershell 158vcpkg install openssl --triplet x32-windows 159$env:OPENSSL_ROOT = "path\x32-windows" 160``` 161 162- Using [vcpkg](https://github.com/Microsoft/vcpkg) and bash: 163```bash 164vcpkg.exe install openssl --triplet x32-windows 165export OPENSSL_ROOT=path/x32-windows 166``` 167 168### Mac OS 169Using [brew](https://github.com/Homebrew/brew): 170```bash 171brew install openssl 172export OPENSSL_ROOT=$(brew --prefix openssl) 173# install bjam tool user specific configuration file to read OPENSSL_ROOT 174# see https://www.bfgroup.xyz/b2/manual/release/index.html 175cp ./libs/beast/tools/user-config.jam $HOME 176``` 177 178Make sure the bjam tool (also called "b2") is available in the path 179your shell uses to find executables. The Beast project is located in 180"libs/beast" relative to the directory containing the Boot superproject. 181To build the Beast tests, examples, and documentation use these commands: 182``` 183export PATH=$PWD:$PATH 184b2 -j2 libs/beast/test cxxstd=11 # bjam must be in your $PATH 185b2 -j2 libs/beast/example cxxstd=11 # "-j2" means use two processors 186b2 libs/beast/doc # Doxygen and Saxon are required for this 187``` 188 189 190 191Additional instructions for configuring, using, and building libraries 192in superproject may be found in the 193[Boost Wiki](https://github.com/boostorg/boost/wiki/Getting-Started). 194 195## Visual Studio 196 197CMake may be used to generate a very nice Visual Studio solution and 198a set of Visual Studio project files using these commands: 199 200``` 201cd libs/beast 202mkdir bin 203cd bin 204cmake .. # for 32-bit Windows builds, or 205cmake -G"Visual Studio 15 2017 Win64" .. # for 64-bit Windows builds (VS2017) 206``` 207 208The files in the repository are laid out thusly: 209 210``` 211./ 212 bin/ Create this to hold executables and project files 213 bin64/ Create this to hold 64-bit Windows executables and project files 214 doc/ Source code and scripts for the documentation 215 include/ Where the header files are located 216 example/ Self contained example programs 217 meta/ Metadata for Boost integration 218 test/ The unit tests for Beast 219 tools/ Scripts used for CI testing 220``` 221 222## Usage 223 224These examples are complete, self-contained programs that you can build 225and run yourself (they are in the `example` directory). 226 227https://www.boost.org/doc/libs/develop/libs/beast/doc/html/beast/quick_start.html 228 229## License 230 231Distributed under the Boost Software License, Version 1.0. 232(See accompanying file [LICENSE_1_0.txt](LICENSE_1_0.txt) or copy at 233https://www.boost.org/LICENSE_1_0.txt) 234 235## Contact 236 237Please report issues or questions here: 238https://github.com/boostorg/beast/issues 239 240--- 241 242## Contributing (We Need Your Help!) 243 244If you would like to contribute to Beast and help us maintain high 245quality, consider performing code reviews on active pull requests. 246Any feedback from users and stakeholders, even simple questions about 247how things work or why they were done a certain way, carries value 248and can be used to improve the library. Code review provides these 249benefits: 250 251* Identify bugs 252* Documentation proof-reading 253* Adjust interfaces to suit use-cases 254* Simplify code 255 256You can look through the Closed pull requests to get an idea of how 257reviews are performed. To give a code review just sign in with your 258GitHub account and then add comments to any open pull requests below, 259don't be shy! 260<p>https://github.com/boostorg/beast/pulls</p> 261 262Here are some resources to learn more about 263code reviews: 264 265* <a href="https://blog.scottnonnenberg.com/top-ten-pull-request-review-mistakes/">Top 10 Pull Request Review Mistakes</a> 266* <a href="https://static1.smartbear.co/smartbear/media/pdfs/best-kept-secrets-of-peer-code-review_redirected.pdf">Best Kept Secrets of Peer Code Review (pdf)</a> 267* <a href="https://static1.smartbear.co/support/media/resources/cc/11_best_practices_for_peer_code_review_redirected.pdf">11 Best Practices for Peer Code Review (pdf)</a> 268* <a href="http://www.evoketechnologies.com/blog/code-review-checklist-perform-effective-code-reviews/">Code Review Checklist – To Perform Effective Code Reviews</a> 269* <a href="https://www.codeproject.com/Articles/524235/Codeplusreviewplusguidelines">Code review guidelines</a> 270* <a href="https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md">C++ Core Guidelines</a> 271* <a href="https://www.oreilly.com/library/view/c-coding-standards/0321113586/">C++ Coding Standards (Sutter & Andrescu)</a> 272 273Beast thrives on code reviews and any sort of feedback from users and 274stakeholders about its interfaces. Even if you just have questions, 275asking them in the code review or in issues provides valuable information 276that can be used to improve the library - do not hesitate, no question 277is insignificant or unimportant! 278