Boost.HTTP.Proto

This is a portable C++ library offering containers and algorithms for implementing the HTTP/1.1 protocol. The format is widely used to deliver content on the Internet, and this implementation adheres strictly to the HTTP/1.1 RFC specification, henceform referred to as the RFC. The library is distinguished by these provided features:

  • Sans-I/O approach

  • Requires only C++11

  • Works without exceptions

  • Fast compilation, few templates

  • Advanced handling of memory (RAM)

Sans-I/O

While this library implements the HTTP protocol, it does so without performing any actual network activity as the logic is completely isolated from the underlying I/O operations. The implementation manages state, ensures RFC compliance, and provides the application-level interface for building and inspecting HTTP messages and their payloads, and it is necessary to use or write the interfacing network implementation on top of HTTP.Proto.

The companion library Boost.HTTP.IO uses Boost.HTTP.Proto to implement network I/O using Boost.Asio. The sans-I/O website goes into more depth regarding this innovative approach to designing protocol libraries.

Requirements

  • Requires Boost and a compiler supporting at least C++11

  • Link to a static or dynamically linked version of this library

  • Supports -fno-exceptions, detected automatically

Tested Compilers

Boost.HTTP.Proto is tested with the following compiler versions:

  • gcc: 5 to 14 (except 8.0.1)

  • clang: 3.9, 4 to 18

  • msvc: 14.1 to 14.42

Quality Assurance

The development infrastructure for the library includes these per-commit analyses:

  • Coverage reports

  • Compilation and tests on Drone.io and GitHub Actions

ABNF

This documentation uses the Augmented Backus-Naur Form (ABNF) notation of rfc5234 to specify particular grammars used by algorithms and containers. While a complete understanding of the notation is not a requirement for using the library, it may help for an understanding of how valid components of HTTP messages are defined. In particular, this is of interest to users who wish to compose parsing algorithms using the combinators provided by the library.

Acknowledgments

This library wouldn’t be where it is today without the help of Peter Dimov for design advice and general assistance.