diff --git a/CHANGELOG.md b/CHANGELOG.md index e0de2360..564c9ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Version 66: * Fix unused parameter warning * Handle bad_alloc in parser * Tidy up message piecewise ctors +* Add header aliases -------------------------------------------------------------------------------- diff --git a/doc/5_02_message.qbk b/doc/5_02_message.qbk index a794bd9b..b59924f4 100644 --- a/doc/5_02_message.qbk +++ b/doc/5_02_message.qbk @@ -7,8 +7,8 @@ [section Message Containers] -Beast provides a single class template __message__ which models -HTTP/1 and +Beast provides a single class template __message__ and some aliases which +model HTTP/1 and [@https://tools.ietf.org/html/rfc7540 HTTP/2] messages: ``` @@ -18,6 +18,14 @@ template< class Body, // Controls the container and algorithms used for the body class Fields = fields> // The type of container to store the fields class message; + +/// A typical HTTP request +template +using request = message; + +/// A typical HTTP response +template +using response = message; ``` The container offers value semantics including move and copy if supported @@ -33,13 +41,21 @@ the container. The library comes with a collection of common body types. As with fields, user defined body types are possible. Sometimes it is desired to only work with a header. Beast provides a single -class template __header__ to model HTTP/1 and HTTP/2 headers: +class template __header__ and some aliases to model HTTP/1 and HTTP/2 headers: ``` /// An HTTP header template< bool isRequest, // `true` for requests, `false` for responses class Fields = fields> // The type of container to store the fields class header; + +/// A typical HTTP request header +template +using request_header = header; + +/// A typical HTTP response header +template +using response_header = header; ``` Requests and responses share the version, fields, and body but have diff --git a/doc/quickref.xml b/doc/quickref.xml index 7047dc9a..0986ad41 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -41,9 +41,11 @@ parser no_chunk_decorator request + request_header request_parser request_serializer response + response_header response_parser response_serializer serializer diff --git a/include/beast/http/message.hpp b/include/beast/http/message.hpp index f709baae..1f7df745 100644 --- a/include/beast/http/message.hpp +++ b/include/beast/http/message.hpp @@ -347,6 +347,14 @@ private: #endif }; +/// A typical HTTP request header +template +using request_header = header; + +/// A typical HTTP response header +template +using response_header = header; + /** A container for a complete HTTP message. This container is derived from the `Fields` template type.