@@ -56,3 +56,58 @@ The following table lists the types used to model containers and views:
5656
5757|===
5858
59+ == Construction
60+
61+ All containers maintain the following invariants:
62+
63+ * The container’s contents are always stored in serialized form that is
64+ syntactically valid.
65+
66+ * Any modification that would produce a malformed field or start line
67+ throws an exception, with strong exception safety guaranteed.
68+
69+ To satisfy these invariants, a default-constructed container provides an
70+ initial start line:
71+
72+ [source,cpp]
73+ ----
74+ request req;
75+ response res;
76+
77+ assert(req->buffer() == "GET / HTTP/1.1\r\n\r\n");
78+ assert(res->buffer() == "HTTP/1.1 200 OK\r\n\r\n");
79+ ----
80+
81+ The `buffer` function runs in constant time, never throws exceptions,
82+ and returns a cpp:boost::core::string_view[] representing the complete
83+ serialized object.
84+
85+ Each header field consists of a name and a value, both stored as strings,
86+ with prescribed ABNF format:
87+
88+ [source]
89+ ----
90+ field-name = token
91+ field-value = *( field-content / obs-fold )
92+ field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
93+ field-vchar = VCHAR / obs-text
94+
95+ obs-fold = CRLF 1*( SP / HTAB )
96+ ; obsolete line folding
97+ ----
98+
99+ Operations which create or modify fields throw exceptions when the name or
100+ value do not meet the syntactic requirements of the protocol.
101+
102+ NOTE: Individual header fields may have their own additional syntactic
103+ requirements, many of which are not checked by the library. For example,
104+ fields whose values represent dates may have particular requirements.
105+ Consult the relevant specifications document to ensure program correctness.
106+
107+ Although fields can be identified by comparing their names, the library
108+ provides the field enumeration, which defines a large set of constants for
109+ well-known field names. Internally, containers maintain a lookup table so
110+ that specifying fields by enumeration replaces costly string comparisons
111+ with efficient integer comparisons.
112+
113+ Header fields are accessed as a bidirectional range whose value type
0 commit comments