<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.7 -->
<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc tocdepth="2"?>
<rfc xmlns:x="http://purl.org/net/xml2rfc/ext"
     category="std"
     docName="draft-ietf-httpbis-header-structure-03"
     ipr="trust200902"
     submissionType="IETF">
   <x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22\&amp;amp;body=%3c{ref}%3e:"/>
   <front>
      <title>Structured Headers for HTTP</title>
      <author fullname="Mark Nottingham" initials="M." surname="Nottingham">
         <organization>Fastly</organization>
         <address>
            <email>mnot@mnot.net</email>
            <uri>https://www.mnot.net/</uri>
         </address>
      </author>
      <author fullname="Poul-Henning Kamp" initials="P-H." surname="Kamp">
         <organization>The Varnish Cache Project</organization>
         <address>
            <email>phk@varnish-cache.org</email>
         </address>
      </author>
      <date year="2018" month="2" day="1"/>
      <area>Applications and Real-Time</area>
      <workgroup>HTTP</workgroup>
      <keyword>Internet-Draft</keyword>
      <abstract>
         <t>This document describes a set of data types and parsing algorithms associated with them that are intended to make it easier and safer to define and handle HTTP header fields. It is intended for use by new specifications of HTTP header fields as well as revisions of existing header field specifications when doing so does not cause interoperability issues.</t>
      </abstract>
      <note title="Note to Readers">
         <t>
            <spanx>RFC EDITOR: please remove this section before publication</spanx>
         </t>
         <t>Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org), which is archived at <eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/">https://lists.w3.org/Archives/Public/ietf-http-wg/</eref>.</t>
         <t>Working Group information can be found at <eref target="https://httpwg.github.io/">https://httpwg.github.io/</eref>; source code and issues list for this draft can be found at <eref target="https://github.com/httpwg/http-extensions/labels/header-structure">https://github.com/httpwg/http-extensions/labels/header-structure</eref>.</t>
      </note>
   </front>
   <middle>
      <section anchor="introduction" title="Introduction">
         <t>Specifying the syntax of new HTTP header fields is an onerous task; even with the guidance in <xref target="RFC7231" x:fmt="," x:sec="8.3.1"/>, there are many decisions – and pitfalls – for a prospective HTTP header field author.</t>
         <t>Once a header field is defined, bespoke parsers for it often need to be written, because each header has slightly different handling of what looks like common syntax.</t>
         <t>This document introduces structured HTTP header field values (hereafter, Structured Headers) to address these problems. Structured Headers define a generic, abstract model for header field values, along with a concrete serialisation for expressing that model in textual HTTP headers, as used by HTTP/1 <xref target="RFC7230"/> and HTTP/2 <xref target="RFC7540"/>.</t>
         <t>HTTP headers that are defined as Structured Headers use the types defined in this specification to define their syntax and basic handling rules, thereby simplifying both their definition and parsing.</t>
         <t>Additionally, future versions of HTTP can define alternative serialisations of the abstract model of Structured Headers, allowing headers that use it to be transmitted more efficiently without being redefined.</t>
         <t>Note that it is not a goal of this document to redefine the syntax of existing HTTP headers; the mechanisms described herein are only intended to be used with headers that explicitly opt into them.</t>
         <t>To specify a header field that uses Structured Headers, see <xref target="specify"/>.</t>
         <t>
            <xref target="types"/> defines a number of abstract data types that can be used in Structured Headers. Dictionaries and lists are only usable at the “top” level, while the remaining types can be specified appear at the top level or inside those structures.</t>
         <t>Those abstract types can be serialised into textual headers – such as those used in HTTP/1 and HTTP/2 – using the algorithms described in <xref target="text"/>.</t>
         <section anchor="notational-conventions" title="Notational Conventions">
            <t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/>
               <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t>
            <t>This document uses the Augmented Backus-Naur Form (ABNF) notation of <xref target="RFC5234"/>, including the DIGIT, ALPHA and DQUOTE rules from that document. It also includes the OWS rule from <xref target="RFC7230"/>.</t>
         </section>
      </section>
      <section anchor="specify" title="Specifying Structured Headers">
         <t>A HTTP header that uses Structured Headers need to be defined to do so explicitly; recipients and generators need to know that the requirements of this document are in effect. The simplest way to do that is by referencing this document in its definition.</t>
         <t>The field’s definition will also need to specify the field-value’s allowed syntax, in terms of the types described in <xref target="types"/>, along with their associated semantics.</t>
         <t>A header field definition cannot relax or otherwise modify the requirements of this specification; doing so would preclude handling by generic software.</t>
         <t>However, header field authors are encouraged to clearly state additional constraints upon the syntax, as well as the consequences when those constraints are violated. Such additional constraints could include additional structure (e.g., a list of URLs <xref target="RFC3986"/> inside a string) that cannot be expressed using the primitives defined here.</t>
         <t>For example:</t>
         <figure>
            <artwork>
# FooExample Header

The FooExample HTTP header field conveys a list of integers about how
much Foo the sender has.

FooExample is a Structured header [RFCxxxx]. Its value MUST be a
dictionary ([RFCxxxx], Section Y.Y).

The dictionary MUST contain:

* A member whose key is "foo", and whose value is an integer
  ([RFCxxxx], Section Y.Y), indicating the number of foos in
  the message.
* A member whose key is "barUrls", and whose value is a string
  ([RFCxxxx], Section Y.Y), conveying the Bar URLs for the message.
  See below for processing requirements.

If the parsed header field does not contain both, it MUST be ignored.

"barUrls" contains a space-separated list of URI-references ([RFC3986], 
Section 4.1):

   barURLs = URI-reference *( 1*SP URI-reference )

If a member of barURLs is not a valid URI-reference, it MUST be ignored.

If a member of barURLs is a relative reference ([RFC3986], Section 4.2),
it MUST be resolved ([RFC3986], Section 5) before being used.
</artwork>
         </figure>
         <t>Note that empty header field values are not allowed by the syntax, and therefore will be considered errors.</t>
      </section>
      <section anchor="text" title="Parsing Text into Structured Headers">
         <t>When a receiving implementation parses textual HTTP header fields (e.g., in HTTP/1 or HTTP/2) that are known to be Structured Headers, it is important that care be taken, as there are a number of edge cases that can cause interoperability or even security problems. This section specifies the algorithm for doing so.</t>
         <t>Given an ASCII string input_string that represents the chosen header’s field-value, return the parsed header value.</t>
         <t>
            <list style="numbers">
               <t>Discard any leading OWS from input_string.</t>
               <t>If the field-value is defined to be a dictionary, let output be the result of Parsing a Dictionary from Textual headers (<xref target="parse-dictionary"/>).</t>
               <t>If the field-value is defined to be a list, let output be the result of Parsing a List from Text (<xref target="parse-list"/>).</t>
               <t>If the field-value is defined to be a parameterised label, let output be the result of Parsing a Parameterised Label from Textual headers (<xref target="parse-parameterised"/>).</t>
               <t>Otherwise, let output be the result of Parsing an Item from Text (<xref target="parse-item"/>).</t>
               <t>Discard any leading OWS from input_string.</t>
               <t>If input_string is not empty, throw an error.</t>
               <t>Otherwise, return output.</t>
            </list>
         </t>
         <t>When generating input_string for a given header field, parsers MUST combine all instances of it into one comma-separated field-value, as per <xref target="RFC7230" x:fmt="," x:sec="3.2.2"/>; this assures that the header is processed correctly.</t>
         <t>Note that in the case of lists and dictionaries, this has the effect of coalescing all of the values for that field. However, for singular items and parameterised labels, it will result in an error being thrown.</t>
         <t>Additionally, note that the effect of the parsing algorithms as specified is generally intolerant of syntax errors; if one is encountered, the typical response is to throw an error, thereby discarding the entire header field value. This includes any non-ASCII characters in input_string.</t>
      </section>
      <section anchor="types" title="Structured Header Data Types">
         <t>This section defines the abstract value types that can be composed into Structured Headers, along with the textual HTTP serialisations of them.</t>
         <section anchor="dictionary" title="Dictionaries">
            <t>Dictionaries are unordered maps of key-value pairs, where the keys are labels (<xref target="label"/>) and the values are items (<xref target="item"/>). There can be between 1 and 1024 members, and keys are required to be unique.</t>
            <t>In the textual HTTP serialisation, keys and values are separated by “=” (without whitespace), and key/value pairs are separated by a comma with optional whitespace. Duplicate keys MUST be considered an error.</t>
            <figure>
               <artwork type="abnf">
dictionary = label "=" item *1023( OWS "," OWS label "=" item )
</artwork>
            </figure>
            <t>For example, a header field whose value is defined as a dictionary could look like:</t>
            <figure>
               <artwork>
ExampleDictHeader: foo=1.23, en="Applepie", da=*w4ZibGV0w6ZydGUK
</artwork>
            </figure>
            <t>Typically, a header field specification will define the semantics of individual keys, as well as whether their presence is required or optional. Recipients MUST ignore keys that are undefined or unknown, unless the header field’s specification specifically disallows them.</t>
            <section anchor="parse-dictionary" title="Parsing a Dictionary from Text">
               <t>Given an ASCII string input_string, return a mapping of (label, item). input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>Let dictionary be an empty, unordered mapping.</t>
                     <t>While input_string is not empty: <list style="numbers">
                           <t>Let this_key be the result of running Parse Label from Text (<xref target="parse-label"/>) with input_string. If an error is encountered, throw it.</t>
                           <t>If dictionary already contains this_key, throw an error.</t>
                           <t>Consume a “=” from input_string; if none is present, throw an error.</t>
                           <t>Let this_value be the result of running Parse Item from Text (<xref target="parse-item"/>) with input_string. If an error is encountered, throw it.</t>
                           <t>Add key this_key with value this_value to dictionary.</t>
                           <t>If dictionary has more than 1024 members, throw an error.</t>
                           <t>Discard any leading OWS from input_string.</t>
                           <t>If input_string is empty, return dictionary.</t>
                           <t>Consume a COMMA from input_string; if no comma is present, throw an error.</t>
                           <t>Discard any leading OWS from input_string.</t>
                        </list>
                     </t>
                     <t>Return dictionary.</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="list" title="Lists">
            <t>Lists are arrays of items (<xref target="item"/>) or parameterised labels (<xref target="param"/>), with one to 1024 members.</t>
            <t>In the textual HTTP serialisation, each member is separated by a comma and optional whitespace.</t>
            <figure>
               <artwork type="abnf">
list = list_member 0*1023( OWS "," OWS list_member )
list_member = item / parameterised
</artwork>
            </figure>
            <t>For example, a header field whose value is defined as a list of labels could look like:</t>
            <figure>
               <artwork>
ExampleLabelListHeader: foo, bar, baz_45
</artwork>
            </figure>
            <t>and a header field whose value is defined as a list of parameterised labels could look like:</t>
            <figure>
               <artwork>
ExampleParamListHeader: abc/def; g="hi";j, klm/nop
</artwork>
            </figure>
            <section anchor="parse-list" title="Parsing a List from Text">
               <t>Given an ASCII string input_string, return a list of items. input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>Let items be an empty array.</t>
                     <t>While input_string is not empty: <list style="numbers">
                           <t>Let item be the result of running Parse Item from Text (<xref target="parse-item"/>) with input_string. If an error is encountered, throw it.</t>
                           <t>Append item to items.</t>
                           <t>If items has more than 1024 members, throw an error.</t>
                           <t>Discard any leading OWS from input_string.</t>
                           <t>If input_string is empty, return items.</t>
                           <t>Consume a COMMA from input_string; if no comma is present, throw an error.</t>
                           <t>Discard any leading OWS from input_string.</t>
                        </list>
                     </t>
                     <t>Return items.</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="param" title="Parameterised Labels">
            <t>Parameterised Labels are labels (<xref target="label"/>) with up to 256 parameters; each parameter has a label and an optional value that is an item (<xref target="item"/>). Ordering between parameters is not significant, and duplicate parameters MUST be considered an error.</t>
            <t>The textual HTTP serialisation uses semicolons (“;”) to delimit the parameters from each other, and equals (“=”) to delimit the parameter name from its value.</t>
            <figure>
               <artwork type="abnf">
parameterised = label *256( OWS ";" OWS label [ "=" item ] )
</artwork>
            </figure>
            <t>For example,</t>
            <figure>
               <artwork>
ExampleParamHeader: abc_123;a=1;b=2; c
</artwork>
            </figure>
            <section anchor="parse-parameterised"
                     title="Parsing a Parameterised Label from Text">
               <t>Given an ASCII string input_string, return a label with an mapping of parameters. input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>Let primary_label be the result of Parsing a Label from Text (<xref target="parse-label"/>) from input_string.</t>
                     <t>Let parameters be an empty, unordered mapping.</t>
                     <t>In a loop: <list style="numbers">
                           <t>Discard any leading OWS from input_string.</t>
                           <t>If the first character of input_string is not “;”, exit the loop.</t>
                           <t>Consume a “;” character from the beginning of input_string.</t>
                           <t>Discard any leading OWS from input_string.</t>
                           <t>let param_name be the result of Parsing a Label from Text (<xref target="parse-label"/>) from input_string.</t>
                           <t>If param_name is already present in parameters, throw an error.</t>
                           <t>Let param_value be a null value.</t>
                           <t>If the first character of input_string is “=”: <list style="numbers">
                                 <t>Consume the “=” character at the beginning of input_string.</t>
                                 <t>Let param_value be the result of Parsing an Item from Text (<xref target="parse-item"/>) from input_string.</t>
                              </list>
                           </t>
                           <t>If parameters has more than 255 members, throw an error.</t>
                           <t>Add param_name to parameters with the value param_value.</t>
                        </list>
                     </t>
                     <t>Return the tuple (primary_label, parameters).</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="item" title="Items">
            <t>An item is can be a integer (<xref target="integer"/>), float (<xref target="float"/>), string (<xref target="string"/>), label (<xref target="label"/>) or binary content (<xref target="binary"/>).</t>
            <figure>
               <artwork type="abnf">
item = integer / float / string / label / binary
</artwork>
            </figure>
            <section anchor="parse-item" title="Parsing an Item from Text">
               <t>Given an ASCII string input_string, return an item. input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>Discard any leading OWS from input_string.</t>
                     <t>If the first character of input_string is a “-“ or a DIGIT, process input_string as a number (<xref target="parse-number"/>) and return the result, throwing any errors encountered.</t>
                     <t>If the first character of input_string is a DQUOTE, process input_string as a string (<xref target="parse-string"/>) and return the result, throwing any errors encountered.</t>
                     <t>If the first character of input_string is “*”, process input_string as binary content (<xref target="parse-binary"/>) and return the result, throwing any errors encountered.</t>
                     <t>If the first character of input_string is an lcalpha, process input_string as a label (<xref target="parse-label"/>) and return the result, throwing any errors encountered.</t>
                     <t>Otherwise, throw an error.</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="integer" title="Integers">
            <t>Abstractly, integers have a range of −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 inclusive (i.e., a 64-bit signed integer).</t>
            <figure>
               <artwork type="abnf">
integer   = ["-"] 1*19DIGIT
</artwork>
            </figure>
            <t>Parsers that encounter an integer outside the range defined above MUST throw an error. Therefore, the value “9223372036854775809” would be invalid. Likewise, values that do not conform to the ABNF above are invalid, and MUST throw an error.</t>
            <t>For example, a header whose value is defined as a integer could look like:</t>
            <figure>
               <artwork>
ExampleIntegerHeader: 42
</artwork>
            </figure>
            <section anchor="parse-number" title="Parsing a Number from Text">
               <t>NOTE: This algorithm parses both Integers and Floats <xref target="float"/>, and returns the corresponding structure.</t>
               <t>
                  <list style="numbers">
                     <t>If the first character of input_string is not “-“ or a DIGIT, throw an error.</t>
                     <t>Let input_number be the result of consuming input_string up to (but not including) the first character that is not in DIGIT, “-“, and “.”.</t>
                     <t>If input_number contains “.”, parse it as a floating point number and let output_number be the result.</t>
                     <t>Otherwise, parse input_number as an integer and let output_number be the result.</t>
                     <t>Return output_number.</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="float" title="Floats">
            <t>Abstractly, floats are integers with a fractional part. They have a maximum of fifteen digits available to be used in both of the parts, as reflected in the ABNF below; this allows them to be stored as IEEE 754 double precision numbers (binary64) (<xref target="IEEE754"/>).</t>
            <t>The textual HTTP serialisation of floats allows a maximum of fifteen digits between the integer and fractional part, with at least one required on each side, along with an optional “-“ indicating negative numbers.</t>
            <figure>
               <artwork type="abnf">
float    = ["-"] (
             DIGIT "." 1*14DIGIT /
            2DIGIT "." 1*13DIGIT /
            3DIGIT "." 1*12DIGIT /
            4DIGIT "." 1*11DIGIT /
            5DIGIT "." 1*10DIGIT /
            6DIGIT "." 1*9DIGIT /
            7DIGIT "." 1*8DIGIT /
            8DIGIT "." 1*7DIGIT /
            9DIGIT "." 1*6DIGIT /
           10DIGIT "." 1*5DIGIT /
           11DIGIT "." 1*4DIGIT /
           12DIGIT "." 1*3DIGIT /
           13DIGIT "." 1*2DIGIT /
           14DIGIT "." 1DIGIT )
</artwork>
            </figure>
            <t>Values that do not conform to the ABNF above are invalid, and MUST throw an error.</t>
            <t>For example, a header whose value is defined as a float could look like:</t>
            <figure>
               <artwork>
ExampleFloatHeader: 4.5
</artwork>
            </figure>
            <t>See <xref target="parse-number"/> for the parsing algorithm for floats.</t>
         </section>
         <section anchor="string" title="Strings">
            <t>Abstractly, strings are ASCII strings <xref target="RFC0020"/>, excluding control characters (i.e., the range 0x20 to 0x7E). Note that this excludes tabs, newlines and carriage returns. They may be at most 1024 characters long.</t>
            <t>The textual HTTP serialisation of strings uses a backslash (“") to escape double quotes and backslashes in strings.</t>
            <figure>
               <artwork type="abnf">
string    = DQUOTE 0*1024(char) DQUOTE
char      = unescaped / escape ( DQUOTE / "\" )
unescaped = %x20-21 / %x23-5B / %x5D-7E
escape    = "\"
</artwork>
            </figure>
            <t>For example, a header whose value is defined as a string could look like:</t>
            <figure>
               <artwork>
ExampleStringHeader: "hello world"
</artwork>
            </figure>
            <t>Note that strings only use DQUOTE as a delimiter; single quotes do not delimit strings. Furthermore, only DQUOTE and “" can be escaped; other sequences MUST generate an error.</t>
            <t>Unicode is not directly supported in Structured Headers, because it causes a number of interoperability issues, and – with few exceptions – header values do not require it.</t>
            <t>When it is necessary for a field value to convey non-ASCII string content, binary content (<xref target="binary"/>) SHOULD be specified, along with a character encoding (most likely, UTF-8).</t>
            <section anchor="parse-string" title="Parsing a String from Text">
               <t>Given an ASCII string input_string, return an unquoted string. input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>Let output_string be an empty string.</t>
                     <t>If the first character of input_string is not DQUOTE, throw an error.</t>
                     <t>Discard the first character of input_string.</t>
                     <t>While input_string is not empty: <list style="numbers">
                           <t>Let char be the result of removing the first character of input_string.</t>
                           <t>If char is a backslash (“\”): <list style="numbers">
                                 <t>If input_string is now empty, throw an error.</t>
                                 <t>Else: <list style="numbers">
                                       <t>Let next_char be the result of removing the first character of input_string.</t>
                                       <t>If next_char is not DQUOTE or “\”, throw an error.</t>
                                       <t>Append next_char to output_string.</t>
                                    </list>
                                 </t>
                              </list>
                           </t>
                           <t>Else, if char is DQUOTE, return output_string.</t>
                           <t>Else, append char to output_string.</t>
                           <t>If output_string contains more than 1024 characters, throw an error.</t>
                        </list>
                     </t>
                     <t>Otherwise, throw an error.</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="label" title="Labels">
            <t>Labels are short (up to 256 characters) textual identifiers; their abstract model is identical to their expression in the textual HTTP serialisation.</t>
            <figure>
               <artwork type="abnf">
label = lcalpha *255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )
lcalpha = %x61-7A ; a-z
</artwork>
            </figure>
            <t>Note that labels can only contain lowercase letters.</t>
            <t>For example, a header whose value is defined as a label could look like:</t>
            <figure>
               <artwork>
ExampleLabelHeader: foo/bar
</artwork>
            </figure>
            <section anchor="parse-label" title="Parsing a Label from Text">
               <t>Given an ASCII string input_string, return a label. input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>If the first character of input_string is not lcalpha, throw an error.</t>
                     <t>Let output_string be an empty string.</t>
                     <t>While input_string is not empty: <list style="numbers">
                           <t>Let char be the result of removing the first character of input_string.</t>
                           <t>If char is not one of lcalpha, DIGIT, “_”, “-“, “*” or “/”: <list style="numbers">
                                 <t>Prepend char to input_string.</t>
                                 <t>Return output_string.</t>
                              </list>
                           </t>
                           <t>Append char to output_string.</t>
                           <t>If output_string contains more than 256 characters, throw an error.</t>
                        </list>
                     </t>
                     <t>Return output_string.</t>
                  </list>
               </t>
            </section>
         </section>
         <section anchor="binary" title="Binary Content">
            <t>Arbitrary binary content up to 16K in size can be conveyed in Structured Headers.</t>
            <t>The textual HTTP serialisation indicates their presence by a leading “*”, with the data encoded using Base 64 Encoding <xref target="RFC4648" x:fmt="," x:sec="4"/>.</t>
            <t>Parsers MUST consider encoded data that is padded an error, as “=” might be confused with the use of dictionaries). See <xref target="RFC4648" x:fmt="," x:sec="3.2"/>.</t>
            <t>Likewise, parsers MUST consider encoded data that has non-zero pad bits an error. See <xref target="RFC4648" x:fmt="," x:sec="3.5"/>.</t>
            <t>This specification does not relax the requirements in <xref target="RFC4648" x:fmt="," x:sec="3.1"/> and 3.3; therefore, parsers MUST consider characters outside the base64 alphabet and line feeds in encoded data as errors.</t>
            <figure>
               <artwork type="abnf">
binary = "*" 0*21846(base64) "*"
base64 = ALPHA / DIGIT / "+" / "/"
</artwork>
            </figure>
            <t>For example, a header whose value is defined as binary content could look like:</t>
            <figure>
               <artwork>
ExampleBinaryHeader: *cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg*
</artwork>
            </figure>
            <section anchor="parse-binary" title="Parsing Binary Content from Text">
               <t>Given an ASCII string input_string, return binary content. input_string is modified to remove the parsed value.</t>
               <t>
                  <list style="numbers">
                     <t>If the first character of input_string is not “*”, throw an error.</t>
                     <t>Discard the first character of input_string.</t>
                     <t>Let b64_content be the result of removing content of input_string up to but not including the first instance of the character “<spanx>”. If there is not a “</spanx>” character before the end of input_string, throw an error.</t>
                     <t>Consume the “*” character at the beginning of input_string.</t>
                     <t>If b64_content is has more than 21846 characters, throw an error.</t>
                     <t>Let binary_content be the result of Base 64 Decoding <xref target="RFC4648"/> b64_content, synthesising padding if necessary. If an error is encountered, throw it (note the requirements about recipient behaviour in <xref target="binary"/>).</t>
                     <t>Return binary_content.</t>
                  </list>
               </t>
            </section>
         </section>
      </section>
      <section anchor="iana-considerations" title="IANA Considerations">
         <t>This draft has no actions for IANA.</t>
      </section>
      <section anchor="security-considerations" title="Security Considerations">
         <t>TBD</t>
      </section>
   </middle>
   <back>
      <references title="Normative References">
         <reference anchor="RFC7230">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
               <author fullname="R. Fielding"
                       initials="R."
                       role="editor"
                       surname="Fielding"/>
               <author fullname="J. Reschke"
                       initials="J."
                       role="editor"
                       surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7230"/>
            <seriesInfo name="DOI" value="10.17487/RFC7230"/>
         </reference>
         <reference anchor="RFC2119">
            <front>
               <title>Key words for use in RFCs to Indicate Requirement Levels</title>
               <author fullname="S. Bradner" initials="S." surname="Bradner"/>
               <date month="March" year="1997"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
         </reference>
         <reference anchor="RFC8174">
            <front>
               <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
               <author fullname="B. Leiba" initials="B." surname="Leiba"/>
               <date month="May" year="2017"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="8174"/>
            <seriesInfo name="DOI" value="10.17487/RFC8174"/>
         </reference>
         <reference anchor="RFC5234">
            <front>
               <title>Augmented BNF for Syntax Specifications: ABNF</title>
               <author fullname="D. Crocker"
                       initials="D."
                       role="editor"
                       surname="Crocker"/>
               <author fullname="P. Overell" initials="P." surname="Overell"/>
               <date month="January" year="2008"/>
            </front>
            <seriesInfo name="STD" value="68"/>
            <seriesInfo name="RFC" value="5234"/>
            <seriesInfo name="DOI" value="10.17487/RFC5234"/>
         </reference>
         <reference anchor="RFC0020">
            <front>
               <title>ASCII format for network interchange</title>
               <author fullname="V.G. Cerf" initials="V.G." surname="Cerf"/>
               <date month="October" year="1969"/>
            </front>
            <seriesInfo name="STD" value="80"/>
            <seriesInfo name="RFC" value="20"/>
            <seriesInfo name="DOI" value="10.17487/RFC0020"/>
         </reference>
         <reference anchor="RFC4648">
            <front>
               <title>The Base16, Base32, and Base64 Data Encodings</title>
               <author fullname="S. Josefsson" initials="S." surname="Josefsson"/>
               <date month="October" year="2006"/>
            </front>
            <seriesInfo name="RFC" value="4648"/>
            <seriesInfo name="DOI" value="10.17487/RFC4648"/>
         </reference>
      </references>
      <references title="Informative References">
         <reference anchor="IEEE754" target="http://grouper.ieee.org/groups/754/">
            <front>
               <title>IEEE Standard for Floating-Point Arithmetic</title>
               <author>
                  <organization>IEEE</organization>
               </author>
               <date year="2008"/>
            </front>
         </reference>
         <reference anchor="RFC7231">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
               <author fullname="R. Fielding"
                       initials="R."
                       role="editor"
                       surname="Fielding"/>
               <author fullname="J. Reschke"
                       initials="J."
                       role="editor"
                       surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7231"/>
            <seriesInfo name="DOI" value="10.17487/RFC7231"/>
         </reference>
         <reference anchor="RFC7540">
            <front>
               <title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
               <author fullname="M. Belshe" initials="M." surname="Belshe"/>
               <author fullname="R. Peon" initials="R." surname="Peon"/>
               <author fullname="M. Thomson"
                       initials="M."
                       role="editor"
                       surname="Thomson"/>
               <date month="May" year="2015"/>
            </front>
            <seriesInfo name="RFC" value="7540"/>
            <seriesInfo name="DOI" value="10.17487/RFC7540"/>
         </reference>
         <reference anchor="RFC3986">
            <front>
               <title>Uniform Resource Identifier (URI): Generic Syntax</title>
               <author fullname="T. Berners-Lee" initials="T." surname="Berners-Lee"/>
               <author fullname="R. Fielding" initials="R." surname="Fielding"/>
               <author fullname="L. Masinter" initials="L." surname="Masinter"/>
               <date month="January" year="2005"/>
            </front>
            <seriesInfo name="STD" value="66"/>
            <seriesInfo name="RFC" value="3986"/>
            <seriesInfo name="DOI" value="10.17487/RFC3986"/>
         </reference>
      </references>
      <section anchor="changes" title="Changes">
         <section anchor="since-draft-ietf-httpbis-header-structure-02"
                  title="Since draft-ietf-httpbis-header-structure-02">
            <t>
               <list style="symbols">
                  <t>Split Numbers into Integers and Floats.</t>
                  <t>Define number parsing.</t>
                  <t>Tighten up binary parsing and give it an explicit end delimiter.</t>
                  <t>Clarify that mappings are unordered.</t>
                  <t>Allow zero-length strings.</t>
                  <t>Improve string parsing algorithm.</t>
                  <t>Improve limits in algorithms.</t>
                  <t>Require parsers to combine header fields before processing.</t>
                  <t>Throw an error on trailing garbage.</t>
               </list>
            </t>
         </section>
         <section anchor="since-draft-ietf-httpbis-header-structure-01"
                  title="Since draft-ietf-httpbis-header-structure-01">
            <t>
               <list style="symbols">
                  <t>Replaced with draft-nottingham-structured-headers.</t>
               </list>
            </t>
         </section>
         <section anchor="since-draft-ietf-httpbis-header-structure-00"
                  title="Since draft-ietf-httpbis-header-structure-00">
            <t>
               <list style="symbols">
                  <t>Added signed 64bit integer type.</t>
                  <t>Drop UTF8, and settle on BCP137 ::EmbeddedUnicodeChar for h1-unicode-string.</t>
                  <t>Change h1_blob delimiter to “:” since “’” is valid t_char</t>
               </list>
            </t>
         </section>
      </section>
   </back>
</rfc>
