rfc8941v4.xml   rfc8941.xml 
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" conse
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent"> nsus="true" docName="draft-ietf-httpbis-header-structure-19" indexInclude="true"
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft ipr="trust200902" number="8941" prepTime="2020-11-12T17:05:31" scripts="Common,
-ietf-httpbis-header-structure-19" number="8941" submissionType="IETF" category= Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocIncl
"std" consensus="true" obsoletes="" updates="" xml:lang="en" tocInclude="true" s ude="true" xml:lang="en">
ortRefs="true" symRefs="true" tocDepth="3" version="3"> <link href="https://datatracker.ietf.org/doc/draft-ietf-httpbis-header-structu
<!-- xml2rfc v2v3 conversion 2.46.0 --> re-19" rel="prev"/>
<link href="https://dx.doi.org/10.17487/rfc8941" rel="alternate"/>
<link href="urn:issn:2070-1721" rel="alternate"/>
<front> <front>
<title>Structured Field Values for HTTP</title> <title>Structured Field Values for HTTP</title>
<seriesInfo name="RFC" value="8941"/> <seriesInfo name="RFC" value="8941" stream="IETF"/>
<author initials="M." surname="Nottingham" fullname="Mark Nottingham"> <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
<organization>Fastly</organization> <organization showOnFrontPage="true">Fastly</organization>
<address> <address>
<postal> <postal>
<city>Prahran</city> <city>Prahran</city>
<region>VIC</region> <region>VIC</region>
<country>Australia</country> <country>Australia</country>
</postal> </postal>
<email>mnot@mnot.net</email> <email>mnot@mnot.net</email>
<uri>https://www.mnot.net/</uri> <uri>https://www.mnot.net/</uri>
</address> </address>
</author> </author>
<author initials="P-H." surname="Kamp" fullname="Poul-Henning Kamp"> <author initials="P-H." surname="Kamp" fullname="Poul-Henning Kamp">
<organization>The Varnish Cache Project</organization> <organization showOnFrontPage="true">The Varnish Cache Project</organizati on>
<address> <address>
<email>phk@varnish-cache.org</email> <email>phk@varnish-cache.org</email>
</address> </address>
</author> </author>
<date month="November" year="2020"/> <date month="11" year="2020"/>
<area>Applications and Real-Time</area> <area>Applications and Real-Time</area>
<workgroup>HTTP</workgroup> <workgroup>HTTP</workgroup>
<abstract> <abstract pn="section-abstract">
<t>This document describes a set of data types and associated algorithms <t indent="0" pn="section-abstract-1">This document describes a set of dat
a types and associated algorithms
that are intended to make it easier and safer to define and handle HTTP that are intended to make it easier and safer to define and handle HTTP
header and trailer fields, known as "Structured Fields", "Structured header and trailer fields, known as "Structured Fields", "Structured
Headers", or "Structured Trailers". It is intended for use by Headers", or "Structured Trailers". It is intended for use by
specifications of new HTTP fields that wish to use a common syntax that specifications of new HTTP fields that wish to use a common syntax that
is more restrictive than traditional HTTP field values.</t> is more restrictive than traditional HTTP field values.</t>
</abstract> </abstract>
<boilerplate>
<section anchor="status-of-memo" numbered="false" removeInRFC="false" toc=
"exclude" pn="section-boilerplate.1">
<name slugifiedName="name-status-of-this-memo">Status of This Memo</name
>
<t indent="0" pn="section-boilerplate.1-1">
This is an Internet Standards Track document.
</t>
<t indent="0" pn="section-boilerplate.1-2">
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.
</t>
<t indent="0" pn="section-boilerplate.1-3">
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
<eref target="https://www.rfc-editor.org/info/rfc8941" brackets="non
e"/>.
</t>
</section>
<section anchor="copyright" numbered="false" removeInRFC="false" toc="excl
ude" pn="section-boilerplate.2">
<name slugifiedName="name-copyright-notice">Copyright Notice</name>
<t indent="0" pn="section-boilerplate.2-1">
Copyright (c) 2020 IETF Trust and the persons identified as the
document authors. All rights reserved.
</t>
<t indent="0" pn="section-boilerplate.2-2">
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<eref target="https://trustee.ietf.org/license-info" brackets="none
"/>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with
respect to this document. Code Components extracted from this
document must include Simplified BSD License text as described in
Section 4.e of the Trust Legal Provisions and are provided without
warranty as described in the Simplified BSD License.
</t>
</section>
</boilerplate>
<toc>
<section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" p
n="section-toc.1">
<name slugifiedName="name-table-of-contents">Table of Contents</name>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="section-to
c.1-1">
<li pn="section-toc.1-1.1">
<t indent="0" keepWithNext="true" pn="section-toc.1-1.1.1"><xref der
ivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref
derivedContent="" format="title" sectionFormat="of" target="name-introduction">
Introduction</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="sectio
n-toc.1-1.1.2">
<li pn="section-toc.1-1.1.2.1">
<t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.1.1"><
xref derivedContent="1.1" format="counter" sectionFormat="of" target="section-1.
1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-in
tentionally-strict-proces">Intentionally Strict Processing</xref></t>
</li>
<li pn="section-toc.1-1.1.2.2">
<t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.2.1"><
xref derivedContent="1.2" format="counter" sectionFormat="of" target="section-1.
2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-no
tational-conventions">Notational Conventions</xref></t>
</li>
</ul>
</li>
<li pn="section-toc.1-1.2">
<t indent="0" pn="section-toc.1-1.2.1"><xref derivedContent="2" form
at="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" f
ormat="title" sectionFormat="of" target="name-defining-new-structured-fie">Defin
ing New Structured Fields</xref></t>
</li>
<li pn="section-toc.1-1.3">
<t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" form
at="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" f
ormat="title" sectionFormat="of" target="name-structured-data-types">Structured
Data Types</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="sectio
n-toc.1-1.3.2">
<li pn="section-toc.1-1.3.2.1">
<t indent="0" pn="section-toc.1-1.3.2.1.1"><xref derivedContent=
"3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-lists">Lists</xref></t
>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="se
ction-toc.1-1.3.2.1.2">
<li pn="section-toc.1-1.3.2.1.2.1">
<t indent="0" pn="section-toc.1-1.3.2.1.2.1.1"><xref derived
Content="3.1.1" format="counter" sectionFormat="of" target="section-3.1.1"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-inner-list
s">Inner Lists</xref></t>
</li>
<li pn="section-toc.1-1.3.2.1.2.2">
<t indent="0" pn="section-toc.1-1.3.2.1.2.2.1"><xref derived
Content="3.1.2" format="counter" sectionFormat="of" target="section-3.1.2"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parameters
">Parameters</xref></t>
</li>
</ul>
</li>
<li pn="section-toc.1-1.3.2.2">
<t indent="0" pn="section-toc.1-1.3.2.2.1"><xref derivedContent=
"3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-dictionaries">Dictiona
ries</xref></t>
</li>
<li pn="section-toc.1-1.3.2.3">
<t indent="0" pn="section-toc.1-1.3.2.3.1"><xref derivedContent=
"3.3" format="counter" sectionFormat="of" target="section-3.3"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-items">Items</xref></t
>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="se
ction-toc.1-1.3.2.3.2">
<li pn="section-toc.1-1.3.2.3.2.1">
<t indent="0" pn="section-toc.1-1.3.2.3.2.1.1"><xref derived
Content="3.3.1" format="counter" sectionFormat="of" target="section-3.3.1"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-integers">
Integers</xref></t>
</li>
<li pn="section-toc.1-1.3.2.3.2.2">
<t indent="0" pn="section-toc.1-1.3.2.3.2.2.1"><xref derived
Content="3.3.2" format="counter" sectionFormat="of" target="section-3.3.2"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-decimals">
Decimals</xref></t>
</li>
<li pn="section-toc.1-1.3.2.3.2.3">
<t indent="0" pn="section-toc.1-1.3.2.3.2.3.1"><xref derived
Content="3.3.3" format="counter" sectionFormat="of" target="section-3.3.3"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-strings">S
trings</xref></t>
</li>
<li pn="section-toc.1-1.3.2.3.2.4">
<t indent="0" pn="section-toc.1-1.3.2.3.2.4.1"><xref derived
Content="3.3.4" format="counter" sectionFormat="of" target="section-3.3.4"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-tokens">To
kens</xref></t>
</li>
<li pn="section-toc.1-1.3.2.3.2.5">
<t indent="0" pn="section-toc.1-1.3.2.3.2.5.1"><xref derived
Content="3.3.5" format="counter" sectionFormat="of" target="section-3.3.5"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-byte-seque
nces">Byte Sequences</xref></t>
</li>
<li pn="section-toc.1-1.3.2.3.2.6">
<t indent="0" pn="section-toc.1-1.3.2.3.2.6.1"><xref derived
Content="3.3.6" format="counter" sectionFormat="of" target="section-3.3.6"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-booleans">
Booleans</xref></t>
</li>
</ul>
</li>
</ul>
</li>
<li pn="section-toc.1-1.4">
<t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" form
at="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" f
ormat="title" sectionFormat="of" target="name-working-with-structured-fie">Worki
ng with Structured Fields in HTTP</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="sectio
n-toc.1-1.4.2">
<li pn="section-toc.1-1.4.2.1">
<t indent="0" pn="section-toc.1-1.4.2.1.1"><xref derivedContent=
"4.1" format="counter" sectionFormat="of" target="section-4.1"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-serializing-structured
-fiel">Serializing Structured Fields</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="se
ction-toc.1-1.4.2.1.2">
<li pn="section-toc.1-1.4.2.1.2.1">
<t indent="0" pn="section-toc.1-1.4.2.1.2.1.1"><xref derived
Content="4.1.1" format="counter" sectionFormat="of" target="section-4.1.1"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-list">Serializing a List</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.2">
<t indent="0" pn="section-toc.1-1.4.2.1.2.2.1"><xref derived
Content="4.1.2" format="counter" sectionFormat="of" target="section-4.1.2"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-dictionary">Serializing a Dictionary</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.3">
<t indent="0" pn="section-toc.1-1.4.2.1.2.3.1"><xref derived
Content="4.1.3" format="counter" sectionFormat="of" target="section-4.1.3"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-an-item">Serializing an Item</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.4">
<t indent="0" pn="section-toc.1-1.4.2.1.2.4.1"><xref derived
Content="4.1.4" format="counter" sectionFormat="of" target="section-4.1.4"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-an-integer">Serializing an Integer</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.5">
<t indent="0" pn="section-toc.1-1.4.2.1.2.5.1"><xref derived
Content="4.1.5" format="counter" sectionFormat="of" target="section-4.1.5"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-decimal">Serializing a Decimal</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.6">
<t indent="0" pn="section-toc.1-1.4.2.1.2.6.1"><xref derived
Content="4.1.6" format="counter" sectionFormat="of" target="section-4.1.6"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-string">Serializing a String</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.7">
<t indent="0" pn="section-toc.1-1.4.2.1.2.7.1"><xref derived
Content="4.1.7" format="counter" sectionFormat="of" target="section-4.1.7"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-token">Serializing a Token</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.8">
<t indent="0" pn="section-toc.1-1.4.2.1.2.8.1"><xref derived
Content="4.1.8" format="counter" sectionFormat="of" target="section-4.1.8"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-byte-sequence">Serializing a Byte Sequence</xref></t>
</li>
<li pn="section-toc.1-1.4.2.1.2.9">
<t indent="0" pn="section-toc.1-1.4.2.1.2.9.1"><xref derived
Content="4.1.9" format="counter" sectionFormat="of" target="section-4.1.9"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-serializin
g-a-boolean">Serializing a Boolean</xref></t>
</li>
</ul>
</li>
<li pn="section-toc.1-1.4.2.2">
<t indent="0" pn="section-toc.1-1.4.2.2.1"><xref derivedContent=
"4.2" format="counter" sectionFormat="of" target="section-4.2"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-parsing-structured-fie
lds">Parsing Structured Fields</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="se
ction-toc.1-1.4.2.2.2">
<li pn="section-toc.1-1.4.2.2.2.1">
<t indent="0" pn="section-toc.1-1.4.2.2.2.1.1"><xref derived
Content="4.2.1" format="counter" sectionFormat="of" target="section-4.2.1"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-a-
list">Parsing a List</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.2">
<t indent="0" pn="section-toc.1-1.4.2.2.2.2.1"><xref derived
Content="4.2.2" format="counter" sectionFormat="of" target="section-4.2.2"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-a-
dictionary">Parsing a Dictionary</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.3">
<t indent="0" pn="section-toc.1-1.4.2.2.2.3.1"><xref derived
Content="4.2.3" format="counter" sectionFormat="of" target="section-4.2.3"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-an
-item">Parsing an Item</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.4">
<t indent="0" pn="section-toc.1-1.4.2.2.2.4.1"><xref derived
Content="4.2.4" format="counter" sectionFormat="of" target="section-4.2.4"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-an
-integer-or-decim">Parsing an Integer or Decimal</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.5">
<t indent="0" pn="section-toc.1-1.4.2.2.2.5.1"><xref derived
Content="4.2.5" format="counter" sectionFormat="of" target="section-4.2.5"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-a-
string">Parsing a String</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.6">
<t indent="0" pn="section-toc.1-1.4.2.2.2.6.1"><xref derived
Content="4.2.6" format="counter" sectionFormat="of" target="section-4.2.6"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-a-
token">Parsing a Token</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.7">
<t indent="0" pn="section-toc.1-1.4.2.2.2.7.1"><xref derived
Content="4.2.7" format="counter" sectionFormat="of" target="section-4.2.7"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-a-
byte-sequence">Parsing a Byte Sequence</xref></t>
</li>
<li pn="section-toc.1-1.4.2.2.2.8">
<t indent="0" pn="section-toc.1-1.4.2.2.2.8.1"><xref derived
Content="4.2.8" format="counter" sectionFormat="of" target="section-4.2.8"/>.  <
xref derivedContent="" format="title" sectionFormat="of" target="name-parsing-a-
boolean">Parsing a Boolean</xref></t>
</li>
</ul>
</li>
</ul>
</li>
<li pn="section-toc.1-1.5">
<t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" form
at="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" f
ormat="title" sectionFormat="of" target="name-iana-considerations">IANA Consider
ations</xref></t>
</li>
<li pn="section-toc.1-1.6">
<t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" form
at="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" f
ormat="title" sectionFormat="of" target="name-security-considerations">Security
Considerations</xref></t>
</li>
<li pn="section-toc.1-1.7">
<t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="7" form
at="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" f
ormat="title" sectionFormat="of" target="name-references">References</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="sectio
n-toc.1-1.7.2">
<li pn="section-toc.1-1.7.2.1">
<t indent="0" pn="section-toc.1-1.7.2.1.1"><xref derivedContent=
"7.1" format="counter" sectionFormat="of" target="section-7.1"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-normative-references">
Normative References</xref></t>
</li>
<li pn="section-toc.1-1.7.2.2">
<t indent="0" pn="section-toc.1-1.7.2.2.1"><xref derivedContent=
"7.2" format="counter" sectionFormat="of" target="section-7.2"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-informative-references
">Informative References</xref></t>
</li>
</ul>
</li>
<li pn="section-toc.1-1.8">
<t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="Appendi
x A" format="default" sectionFormat="of" target="section-appendix.a"/>.  <xref d
erivedContent="" format="title" sectionFormat="of" target="name-frequently-asked
-questions">Frequently Asked Questions</xref></t>
<ul bare="true" empty="true" indent="2" spacing="compact" pn="sectio
n-toc.1-1.8.2">
<li pn="section-toc.1-1.8.2.1">
<t indent="0" pn="section-toc.1-1.8.2.1.1"><xref derivedContent=
"A.1" format="counter" sectionFormat="of" target="section-a.1"/>.  <xref derived
Content="" format="title" sectionFormat="of" target="name-why-not-json">Why Not
JSON?</xref></t>
</li>
</ul>
</li>
<li pn="section-toc.1-1.9">
<t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="Appendi
x B" format="default" sectionFormat="of" target="section-appendix.b"/>.  <xref d
erivedContent="" format="title" sectionFormat="of" target="name-implementation-n
otes">Implementation Notes</xref></t>
</li>
<li pn="section-toc.1-1.10">
<t indent="0" pn="section-toc.1-1.10.1"><xref derivedContent="" form
at="none" sectionFormat="of" target="section-appendix.c"/><xref derivedContent="
" format="title" sectionFormat="of" target="name-acknowledgements">Acknowledgeme
nts</xref></t>
</li>
<li pn="section-toc.1-1.11">
<t indent="0" pn="section-toc.1-1.11.1"><xref derivedContent="" form
at="none" sectionFormat="of" target="section-appendix.d"/><xref derivedContent="
" format="title" sectionFormat="of" target="name-authors-addresses">Authors' Add
resses</xref></t>
</li>
</ul>
</section>
</toc>
</front> </front>
<middle> <middle>
<section anchor="introduction"> <section anchor="introduction" numbered="true" removeInRFC="false" toc="incl
<name>Introduction</name> ude" pn="section-1">
<t>Specifying the syntax of new HTTP header (and trailer) fields is an <name slugifiedName="name-introduction">Introduction</name>
onerous task; even with the guidance in <xref target="RFC7231" section="8. <t indent="0" pn="section-1-1">Specifying the syntax of new HTTP header (a
3.1"/>, there are many decisions -- and nd trailer) fields is an
onerous task; even with the guidance in <xref target="RFC7231" section="8.
3.1" format="default" sectionFormat="of" derivedLink="https://rfc-editor.org/rfc
/rfc7231#section-8.3.1" derivedContent="RFC7231"/>, there are many decisions --
and
pitfalls -- for a prospective HTTP field author.</t> pitfalls -- for a prospective HTTP field author.</t>
<t>Once a field is defined, bespoke parsers and serializers often need <t indent="0" pn="section-1-2">Once a field is defined, bespoke parsers an d serializers often need
to be written, because each field value has a slightly different handling to be written, because each field value has a slightly different handling
of what looks like common syntax.</t> of what looks like common syntax.</t>
<t>This document introduces a set of common data structures for use in <t indent="0" pn="section-1-3">This document introduces a set of common da ta structures for use in
definitions of new HTTP field values to address these problems. In definitions of new HTTP field values to address these problems. In
particular, it defines a generic, abstract model for them, along with a particular, it defines a generic, abstract model for them, along with a
concrete serialization for expressing that model in HTTP <xref target="RFC concrete serialization for expressing that model in HTTP <xref target="RFC
7230"/> header and trailer fields.</t> 7230" format="default" sectionFormat="of" derivedContent="RFC7230"/> header and
<t>An HTTP field that is defined as a "Structured Header" or "Structured trailer fields.</t>
<t indent="0" pn="section-1-4">An HTTP field that is defined as a "Structu
red Header" or "Structured
Trailer" (if the field can be either, it is a "Structured Field") uses Trailer" (if the field can be either, it is a "Structured Field") uses
the types defined in this specification to define its syntax and basic the types defined in this specification to define its syntax and basic
handling rules, thereby simplifying both its definition by specification handling rules, thereby simplifying both its definition by specification
writers and handling by implementations.</t> writers and handling by implementations.</t>
<t>Additionally, future versions of HTTP can define alternative <t indent="0" pn="section-1-5">Additionally, future versions of HTTP can d efine alternative
serializations of the abstract model of these structures, allowing serializations of the abstract model of these structures, allowing
fields that use that model to be transmitted more efficiently without fields that use that model to be transmitted more efficiently without
being redefined.</t> being redefined.</t>
<t>Note that it is not a goal of this document to redefine the syntax of <t indent="0" pn="section-1-6">Note that it is not a goal of this document to redefine the syntax of
existing HTTP fields; the mechanisms described herein are only intended existing HTTP fields; the mechanisms described herein are only intended
to be used with fields that explicitly opt into them.</t> to be used with fields that explicitly opt into them.</t>
<t><xref target="specify"/> describes how to specify a <t indent="0" pn="section-1-7"><xref target="specify" format="default" sec tionFormat="of" derivedContent="Section 2"/> describes how to specify a
Structured Field.</t> Structured Field.</t>
<t><xref target="types"/> defines a number of abstract <t indent="0" pn="section-1-8"><xref target="types" format="default" secti onFormat="of" derivedContent="Section 3"/> defines a number of abstract
data types that can be used in Structured Fields.</t> data types that can be used in Structured Fields.</t>
<t>Those abstract types can be serialized into and parsed from HTTP <t indent="0" pn="section-1-9">Those abstract types can be serialized into
field values using the algorithms described in <xref target="text"/>.</t> and parsed from HTTP
<section anchor="strict"> field values using the algorithms described in <xref target="text" format=
<name>Intentionally Strict Processing</name> "default" sectionFormat="of" derivedContent="Section 4"/>.</t>
<t>This specification intentionally defines strict parsing and <section anchor="strict" numbered="true" removeInRFC="false" toc="include"
pn="section-1.1">
<name slugifiedName="name-intentionally-strict-proces">Intentionally Str
ict Processing</name>
<t indent="0" pn="section-1.1-1">This specification intentionally define
s strict parsing and
serialization behaviors using step-by-step algorithms; the only error serialization behaviors using step-by-step algorithms; the only error
handling defined is to fail the operation altogether.</t> handling defined is to fail the operation altogether.</t>
<t>It is designed to encourage faithful implementation and therefore <t indent="0" pn="section-1.1-2">It is designed to encourage faithful im plementation and therefore
good interoperability. Therefore, an implementation that tried to be good interoperability. Therefore, an implementation that tried to be
helpful by being more tolerant of input would make interoperability helpful by being more tolerant of input would make interoperability
worse, since that would create pressure on other implementations to worse, since that would create pressure on other implementations to
implement similar (but likely subtly different) workarounds.</t> implement similar (but likely subtly different) workarounds.</t>
<t>In other words, strict processing is an intentional feature of this <t indent="0" pn="section-1.1-3">In other words, strict processing is an intentional feature of this
specification; it allows non-conformant input to be discovered and specification; it allows non-conformant input to be discovered and
corrected by the producer early and avoids both interoperability and corrected by the producer early and avoids both interoperability and
security issues that might otherwise result.</t> security issues that might otherwise result.</t>
<t>Note that as a result of this strictness, if a field is appended to <t indent="0" pn="section-1.1-4">Note that as a result of this strictnes s, if a field is appended to
by multiple parties (e.g., intermediaries or different components in by multiple parties (e.g., intermediaries or different components in
the sender), an error in one party's value is likely to cause the the sender), an error in one party's value is likely to cause the
entire field value to fail parsing.</t> entire field value to fail parsing.</t>
</section> </section>
<section anchor="notational-conventions"> <section anchor="notational-conventions" numbered="true" removeInRFC="fals
<name>Notational Conventions</name> e" toc="include" pn="section-1.2">
<t> <name slugifiedName="name-notational-conventions">Notational Conventions
</name>
<t indent="0" pn="section-1.2-1">
The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
"<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", ", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>",
"<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are
to be interpreted as to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> described in BCP 14 <xref target="RFC2119" format="default" sectionFormat="o f" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFor mat="of" derivedContent="RFC8174"/>
when, and only when, they appear in all capitals, as shown here. when, and only when, they appear in all capitals, as shown here.
</t> </t>
<t>This document uses algorithms to specify parsing and serialization <t indent="0" pn="section-1.2-2">This document uses algorithms to specif
behaviors and the Augmented Backus-Naur Form (ABNF) notation of <xref tar y parsing and serialization
get="RFC5234"/> to illustrate expected syntax in behaviors and the Augmented Backus-Naur Form (ABNF) notation of <xref tar
get="RFC5234" format="default" sectionFormat="of" derivedContent="RFC5234"/> to
illustrate expected syntax in
HTTP header fields. In doing so, it uses the VCHAR, SP, DIGIT, ALPHA, HTTP header fields. In doing so, it uses the VCHAR, SP, DIGIT, ALPHA,
and DQUOTE rules from <xref target="RFC5234"/>. It and DQUOTE rules from <xref target="RFC5234" format="default" sectionForm
also includes the tchar and OWS rules from <xref target="RFC7230"/>.</t> at="of" derivedContent="RFC5234"/>. It
<t>When parsing from HTTP fields, implementations <bcp14>MUST</bcp14> ha also includes the tchar and OWS rules from <xref target="RFC7230" format=
ve behavior "default" sectionFormat="of" derivedContent="RFC7230"/>.</t>
<t indent="0" pn="section-1.2-3">When parsing from HTTP fields, implemen
tations <bcp14>MUST</bcp14> have behavior
that is indistinguishable from following the algorithms. If there is that is indistinguishable from following the algorithms. If there is
disagreement between the parsing algorithms and ABNF, the specified disagreement between the parsing algorithms and ABNF, the specified
algorithms take precedence.</t> algorithms take precedence.</t>
<t>For serialization to HTTP fields, the ABNF illustrates their <t indent="0" pn="section-1.2-4">For serialization to HTTP fields, the A BNF illustrates their
expected wire representations, and the algorithms define the expected wire representations, and the algorithms define the
recommended way to produce them. Implementations <bcp14>MAY</bcp14> vary from the recommended way to produce them. Implementations <bcp14>MAY</bcp14> vary from the
specified behavior so long as the output is still correctly handled by specified behavior so long as the output is still correctly handled by
the parsing algorithm.</t> the parsing algorithm.</t>
</section> </section>
</section> </section>
<section anchor="specify"> <section anchor="specify" numbered="true" removeInRFC="false" toc="include"
<name>Defining New Structured Fields</name> pn="section-2">
<t>To specify an HTTP field as a Structured Field, its authors need to:</t <name slugifiedName="name-defining-new-structured-fie">Defining New Struct
> ured Fields</name>
<ul> <t indent="0" pn="section-2-1">To specify an HTTP field as a Structured Fi
<li>Normatively reference this specification. Recipients and eld, its authors need to:</t>
<ul bare="false" empty="false" indent="3" spacing="normal" pn="section-2-2
">
<li pn="section-2-2.1">Normatively reference this specification. Recipie
nts and
generators of the field need to know that the requirements of this generators of the field need to know that the requirements of this
document are in effect.</li> document are in effect.</li>
<li>Identify whether the field is a Structured Header (i.e., it can <li pn="section-2-2.2">Identify whether the field is a Structured Header (i.e., it can
only be used in the header section -- the common case), a Structured only be used in the header section -- the common case), a Structured
Trailer (only in the trailer section), or a Structured Field Trailer (only in the trailer section), or a Structured Field
(both).</li> (both).</li>
<li>Specify the type of the field value; either List (<xref target="list <li pn="section-2-2.3">Specify the type of the field value; either List
"/>), Dictionary (<xref target="dictionary"/>), or Item (<xref target="item"/>). (<xref target="list" format="default" sectionFormat="of" derivedContent="Section
</li> 3.1"/>), Dictionary (<xref target="dictionary" format="default" sectionFormat="
<li>Define the semantics of the field value.</li> of" derivedContent="Section 3.2"/>), or Item (<xref target="item" format="defaul
<li>Specify any additional constraints upon the field value, as well t" sectionFormat="of" derivedContent="Section 3.3"/>).</li>
<li pn="section-2-2.4">Define the semantics of the field value.</li>
<li pn="section-2-2.5">Specify any additional constraints upon the field
value, as well
as the consequences when those constraints are violated.</li> as the consequences when those constraints are violated.</li>
</ul> </ul>
<t>Typically, this means that a field definition will specify the <t indent="0" pn="section-2-3">Typically, this means that a field definiti on will specify the
top-level type -- List, Dictionary, or Item -- and then define its top-level type -- List, Dictionary, or Item -- and then define its
allowable types and constraints upon them. For example, a header allowable types and constraints upon them. For example, a header
defined as a List might have all Integer members, or a mix of types; a defined as a List might have all Integer members, or a mix of types; a
header defined as an Item might allow only Strings, and additionally header defined as an Item might allow only Strings, and additionally
only strings beginning with the letter "Q", or strings in only strings beginning with the letter "Q", or strings in
lowercase. Likewise, Inner Lists (<xref target="inner-list"/>) are only va lid when a field definition explicitly lowercase. Likewise, Inner Lists (<xref target="inner-list" format="defaul t" sectionFormat="of" derivedContent="Section 3.1.1"/>) are only valid when a fi eld definition explicitly
allows them.</t> allows them.</t>
<t>When parsing fails, the entire field is ignored (see <xref target="text -parse"/>); in most situations, violating <t indent="0" pn="section-2-4">When parsing fails, the entire field is ign ored (see <xref target="text-parse" format="default" sectionFormat="of" derivedC ontent="Section 4.2"/>); in most situations, violating
field-specific constraints should have the same effect. Thus, if a field-specific constraints should have the same effect. Thus, if a
header is defined as an Item and required to be an Integer, but a String header is defined as an Item and required to be an Integer, but a String
is received, the field will by default be ignored. If the field requires is received, the field will by default be ignored. If the field requires
different error handling, this should be explicitly specified.</t> different error handling, this should be explicitly specified.</t>
<t>Both Items and Inner Lists allow parameters as an extensibility <t indent="0" pn="section-2-5">Both Items and Inner Lists allow parameters as an extensibility
mechanism; this means that values can later be extended to accommodate mechanism; this means that values can later be extended to accommodate
more information, if need be. To preserve forward compatibility, field more information, if need be. To preserve forward compatibility, field
specifications are discouraged from defining the presence of an specifications are discouraged from defining the presence of an
unrecognized parameter as an error condition.</t> unrecognized parameter as an error condition.</t>
<t>To further assure that this extensibility is available in the future, <t indent="0" pn="section-2-6">To further assure that this extensibility i s available in the future,
and to encourage consumers to use a complete parser implementation, a and to encourage consumers to use a complete parser implementation, a
field definition can specify that "grease" parameters be added by field definition can specify that "grease" parameters be added by
senders. A specification could stipulate that all parameters that fit a senders. A specification could stipulate that all parameters that fit a
defined pattern are reserved for this use and then encourage them to be defined pattern are reserved for this use and then encourage them to be
sent on some portion of requests. This helps to discourage recipients sent on some portion of requests. This helps to discourage recipients
from writing a parser that does not account for Parameters.</t> from writing a parser that does not account for Parameters.</t>
<t>Specifications that use Dictionaries can also allow for forward <t indent="0" pn="section-2-7">Specifications that use Dictionaries can al so allow for forward
compatibility by requiring that the presence of -- as well as value and compatibility by requiring that the presence of -- as well as value and
type associated with -- unknown members be ignored. Subsequent specificati ons type associated with -- unknown members be ignored. Subsequent specificati ons
can then add additional members, specifying constraints on them as can then add additional members, specifying constraints on them as
appropriate.</t> appropriate.</t>
<t>An extension to a Structured Field can then require that an entire <t indent="0" pn="section-2-8">An extension to a Structured Field can then require that an entire
field value be ignored by a recipient that understands the extension if field value be ignored by a recipient that understands the extension if
constraints on the value it defines are not met.</t> constraints on the value it defines are not met.</t>
<t>A field definition cannot relax the requirements of this <t indent="0" pn="section-2-9">A field definition cannot relax the require ments of this
specification because doing so would preclude handling by generic specification because doing so would preclude handling by generic
software; they can only add additional constraints (for example, on the software; they can only add additional constraints (for example, on the
numeric range of Integers and Decimals, the format of Strings and numeric range of Integers and Decimals, the format of Strings and
Tokens, the types allowed in a Dictionary's values, or the number of Tokens, the types allowed in a Dictionary's values, or the number of
Items in a List). Likewise, field definitions can only use this Items in a List). Likewise, field definitions can only use this
specification for the entire field value, not a portion thereof.</t> specification for the entire field value, not a portion thereof.</t>
<t>This specification defines minimums for the length or number of <t indent="0" pn="section-2-10">This specification defines minimums for th e length or number of
various structures supported by implementations. It does not specify various structures supported by implementations. It does not specify
maximum sizes in most cases, but authors should be aware that HTTP maximum sizes in most cases, but authors should be aware that HTTP
implementations do impose various limits on the size of individual implementations do impose various limits on the size of individual
fields, the total number of fields, and/or the size of the entire header fields, the total number of fields, and/or the size of the entire header
or trailer section.</t> or trailer section.</t>
<t>Specifications can refer to a field name as a "structured header <t indent="0" pn="section-2-11">Specifications can refer to a field name a s a "structured header
name", "structured trailer name", or "structured field name" as name", "structured trailer name", or "structured field name" as
appropriate. Likewise, they can refer its field value as a "structured appropriate. Likewise, they can refer its field value as a "structured
header value", "structured trailer value", or "structured field value" as header value", "structured trailer value", or "structured field value" as
necessary. necessary.
Field definitions are encouraged to use the ABNF rules Field definitions are encouraged to use the ABNF rules
beginning with "sf-" defined in this specification; other rules in this beginning with "sf-" defined in this specification; other rules in this
specification are not intended to be used in field definitions.</t> specification are not intended to be used in field definitions.</t>
<t>For example, a fictitious Foo-Example header field might be specified <t indent="0" pn="section-2-12">For example, a fictitious Foo-Example head er field might be specified
as:</t> as:</t>
<blockquote pn="section-2-13">
<blockquote> <t indent="0" pn="section-2-13.1">42. Foo-Example Header</t>
<t>42. Foo-Example Header</t> <t indent="0" pn="section-2-13.2">The Foo-Example HTTP header field conv
eys information about how
<t>The Foo-Example HTTP header field conveys information about how
much Foo the message has.</t> much Foo the message has.</t>
<t indent="0" pn="section-2-13.3">Foo-Example is an Item Structured Head
<t>Foo-Example is an Item Structured Header [RFCxxxx]. Its value MUST be er [RFCxxxx]. Its value MUST be
an Integer (Section Y.Y of [RFCxxxx]). Its ABNF is:</t> an Integer (Section Y.Y of [RFCxxxx]). Its ABNF is:</t>
<artwork align="left" pn="section-2-13.4">
<artwork>
Foo-Example = sf-integer Foo-Example = sf-integer
</artwork> </artwork>
<t indent="0" pn="section-2-13.5">Its value indicates the amount of Foo
<t>Its value indicates the amount of Foo in the message, and it MUST in the message, and it MUST
be between 0 and 10, inclusive; other values MUST cause be between 0 and 10, inclusive; other values MUST cause
the entire header field to be ignored.</t> the entire header field to be ignored.</t>
<t indent="0" pn="section-2-13.6">The following parameter is defined:</t
<t>The following parameter is defined:</t> >
<ul bare="false" empty="false" indent="3" spacing="normal" pn="section-2
<ul> -13.7">
<li>A parameter whose name is "foourl", and whose value is a String <li pn="section-2-13.7.1">A parameter whose name is "foourl", and whos
e value is a String
(Section Y.Y of [RFCxxxx]), conveying the Foo URL (Section Y.Y of [RFCxxxx]), conveying the Foo URL
for the message. See below for processing requirements.</li> for the message. See below for processing requirements.</li>
</ul> </ul>
<t indent="0" pn="section-2-13.8">"foourl" contains a URI-reference (Sec
<t>"foourl" contains a URI-reference (Section 4.1 of [RFC3986]). If tion 4.1 of [RFC3986]). If
its value is not a valid URI-reference, the entire header field its value is not a valid URI-reference, the entire header field
MUST be ignored. If its value is a relative reference (Section 4.2 MUST be ignored. If its value is a relative reference (Section 4.2
of [RFC3986]), it MUST be resolved (Section 5 of [RFC3986]) before of [RFC3986]), it MUST be resolved (Section 5 of [RFC3986]) before
being used.</t> being used.</t>
<t indent="0" pn="section-2-13.9">For example:</t>
<t>For example:</t> <artwork align="left" pn="section-2-13.10">
<artwork>
Foo-Example: 2; foourl="https://foo.example.com/" Foo-Example: 2; foourl="https://foo.example.com/"
</artwork> </artwork>
</blockquote> </blockquote>
</section> </section>
<section anchor="types"> <section anchor="types" numbered="true" removeInRFC="false" toc="include" pn
<name>Structured Data Types</name> ="section-3">
<t>This section defines the abstract types for Structured Fields. The <name slugifiedName="name-structured-data-types">Structured Data Types</na
me>
<t indent="0" pn="section-3-1">This section defines the abstract types for
Structured Fields. The
ABNF provided represents the on-wire format in HTTP field values.</t> ABNF provided represents the on-wire format in HTTP field values.</t>
<t>In summary:</t> <t indent="0" pn="section-3-2">In summary:</t>
<ul> <ul bare="false" empty="false" indent="3" spacing="normal" pn="section-3-3
<li>There are three top-level types that an HTTP field can be defined ">
<li pn="section-3-3.1">There are three top-level types that an HTTP fiel
d can be defined
as: Lists, Dictionaries, and Items.</li> as: Lists, Dictionaries, and Items.</li>
<li>Lists and Dictionaries are containers; their members can be Items <li pn="section-3-3.2">Lists and Dictionaries are containers; their memb ers can be Items
or Inner Lists (which are themselves arrays of Items).</li> or Inner Lists (which are themselves arrays of Items).</li>
<li>Both Items and Inner Lists can be Parameterized with key/value pairs .</li> <li pn="section-3-3.3">Both Items and Inner Lists can be Parameterized w ith key/value pairs.</li>
</ul> </ul>
<section anchor="list"> <section anchor="list" numbered="true" removeInRFC="false" toc="include" p
<name>Lists</name> n="section-3.1">
<t>Lists are arrays of zero or more members, each of which can be an <name slugifiedName="name-lists">Lists</name>
Item (<xref target="item"/>) or an Inner List (<xref target="inner-list"/ <t indent="0" pn="section-3.1-1">Lists are arrays of zero or more member
>), both of which can be s, each of which can be an
Parameterized (<xref target="param"/>).</t> Item (<xref target="item" format="default" sectionFormat="of" derivedCont
<t>The ABNF for Lists in HTTP fields is:</t> ent="Section 3.3"/>) or an Inner List (<xref target="inner-list" format="default
<sourcecode type="abnf"> " sectionFormat="of" derivedContent="Section 3.1.1"/>), both of which can be
Parameterized (<xref target="param" format="default" sectionFormat="of" d
erivedContent="Section 3.1.2"/>).</t>
<t indent="0" pn="section-3.1-2">The ABNF for Lists in HTTP fields is:</
t>
<sourcecode type="abnf" markers="false" pn="section-3.1-3">
sf-list = list-member *( OWS "," OWS list-member ) sf-list = list-member *( OWS "," OWS list-member )
list-member = sf-item / inner-list list-member = sf-item / inner-list
</sourcecode> </sourcecode>
<t>Each member is separated by a comma and optional whitespace. For <t indent="0" pn="section-3.1-4">Each member is separated by a comma and optional whitespace. For
example, a field whose value is defined as a List of Strings could example, a field whose value is defined as a List of Strings could
look like:</t> look like:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1-5">
Example-List: "foo", "bar", "It was the best of times." Example-List: "foo", "bar", "It was the best of times."
</sourcecode> </sourcecode>
<t>An empty List is denoted by not serializing the field at all. This <t indent="0" pn="section-3.1-6">An empty List is denoted by not seriali zing the field at all. This
implies that fields defined as Lists have a default empty value.</t> implies that fields defined as Lists have a default empty value.</t>
<t>Note that Lists can have their members split across multiple lines <t indent="0" pn="section-3.1-7">Note that Lists can have their members
inside a header or trailer section, as per <xref target="RFC7230" section split across multiple lines
="3.2.2"/>; for example, the following are inside a header or trailer section, as per <xref target="RFC7230" section
="3.2.2" format="default" sectionFormat="of" derivedLink="https://rfc-editor.org
/rfc/rfc7230#section-3.2.2" derivedContent="RFC7230"/>; for example, the followi
ng are
equivalent:</t> equivalent:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1-8">
Example-List: foo, bar Example-List: foo, bar
</sourcecode> </sourcecode>
<t>and</t> <t indent="0" pn="section-3.1-9">and</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1-10">
Example-List: foo Example-List: foo
Example-List: bar Example-List: bar
</sourcecode> </sourcecode>
<t>However, individual members of a List cannot be safely split <t indent="0" pn="section-3.1-11">However, individual members of a List
between lines; see <xref target="text-parse"/> cannot be safely split
between lines; see <xref target="text-parse" format="default" sectionForm
at="of" derivedContent="Section 4.2"/>
for details.</t> for details.</t>
<t>Parsers <bcp14>MUST</bcp14> support Lists containing at least 1024 me mbers. Field <t indent="0" pn="section-3.1-12">Parsers <bcp14>MUST</bcp14> support Li sts containing at least 1024 members. Field
specifications can constrain the types and cardinality of individual specifications can constrain the types and cardinality of individual
List values as they require.</t> List values as they require.</t>
<section anchor="inner-list"> <section anchor="inner-list" numbered="true" removeInRFC="false" toc="in
<name>Inner Lists</name> clude" pn="section-3.1.1">
<t>An Inner List is an array of zero or more Items (<xref target="item <name slugifiedName="name-inner-lists">Inner Lists</name>
"/>). Both the individual Items and the <t indent="0" pn="section-3.1.1-1">An Inner List is an array of zero o
Inner List itself can be Parameterized (<xref target="param"/>).</t> r more Items (<xref target="item" format="default" sectionFormat="of" derivedCon
<t>The ABNF for Inner Lists is:</t> tent="Section 3.3"/>). Both the individual Items and the
<sourcecode type="abnf"> Inner List itself can be Parameterized (<xref target="param" format="de
fault" sectionFormat="of" derivedContent="Section 3.1.2"/>).</t>
<t indent="0" pn="section-3.1.1-2">The ABNF for Inner Lists is:</t>
<sourcecode type="abnf" markers="false" pn="section-3.1.1-3">
inner-list = "(" *SP [ sf-item *( 1*SP sf-item ) *SP ] ")" inner-list = "(" *SP [ sf-item *( 1*SP sf-item ) *SP ] ")"
parameters parameters
</sourcecode> </sourcecode>
<t>Inner Lists are denoted by surrounding parenthesis, and <t indent="0" pn="section-3.1.1-4">Inner Lists are denoted by surround ing parenthesis, and
their values are delimited by one or more spaces. A field whose value i s their values are delimited by one or more spaces. A field whose value i s
defined as a List of Inner Lists of Strings could look like:</t> defined as a List of Inner Lists of Strings could look like:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1.1-5">
Example-List: ("foo" "bar"), ("baz"), ("bat" "one"), () Example-List: ("foo" "bar"), ("baz"), ("bat" "one"), ()
</sourcecode> </sourcecode>
<t>Note that the last member in this example is an empty Inner List.</ <t indent="0" pn="section-3.1.1-6">Note that the last member in this e
t> xample is an empty Inner List.</t>
<t>A header field whose value is defined as a List of Inner Lists <t indent="0" pn="section-3.1.1-7">A header field whose value is defin
ed as a List of Inner Lists
with Parameters at both levels could look like:</t> with Parameters at both levels could look like:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1.1-8">
Example-List: ("foo"; a=1;b=2);lvl=5, ("bar" "baz");lvl=1 Example-List: ("foo"; a=1;b=2);lvl=5, ("bar" "baz");lvl=1
</sourcecode> </sourcecode>
<t>Parsers <bcp14>MUST</bcp14> support Inner Lists containing at least 256 <t indent="0" pn="section-3.1.1-9">Parsers <bcp14>MUST</bcp14> support Inner Lists containing at least 256
members. Field specifications can constrain the types and members. Field specifications can constrain the types and
cardinality of individual Inner List members as they require.</t> cardinality of individual Inner List members as they require.</t>
</section> </section>
<section anchor="param"> <section anchor="param" numbered="true" removeInRFC="false" toc="include
<name>Parameters</name> " pn="section-3.1.2">
<t>Parameters are an ordered map of key-value pairs that are <name slugifiedName="name-parameters">Parameters</name>
associated with an Item (<xref target="item"/>) or <t indent="0" pn="section-3.1.2-1">Parameters are an ordered map of ke
Inner List (<xref target="inner-list"/>). y-value pairs that are
associated with an Item (<xref target="item" format="default" sectionFo
rmat="of" derivedContent="Section 3.3"/>) or
Inner List (<xref target="inner-list" format="default" sectionFormat="o
f" derivedContent="Section 3.1.1"/>).
The keys The keys
are unique within the scope of the Parameters they occur within, and are unique within the scope of the Parameters they occur within, and
the values are bare items (i.e., they themselves cannot be the values are bare items (i.e., they themselves cannot be
parameterized; see <xref target="item"/>).</t> parameterized; see <xref target="item" format="default" sectionFormat="
<t>The ABNF for Parameters is:</t> of" derivedContent="Section 3.3"/>).</t>
<sourcecode type="abnf"> <t indent="0" pn="section-3.1.2-2">The ABNF for Parameters is:</t>
<sourcecode type="abnf" markers="false" pn="section-3.1.2-3">
parameters = *( ";" *SP parameter ) parameters = *( ";" *SP parameter )
parameter = param-name [ "=" param-value ] parameter = param-name [ "=" param-value ]
param-name = key param-name = key
key = ( lcalpha / "*" ) key = ( lcalpha / "*" )
*( lcalpha / DIGIT / "_" / "-" / "." / "*" ) *( lcalpha / DIGIT / "_" / "-" / "." / "*" )
lcalpha = %x61-7A ; a-z lcalpha = %x61-7A ; a-z
param-value = bare-item param-value = bare-item
</sourcecode> </sourcecode>
<t>Note that parameters are ordered as serialized, and parameter <t indent="0" pn="section-3.1.2-4">Note that parameters are ordered as serialized, and parameter
keys cannot contain uppercase letters. A parameter is separated from keys cannot contain uppercase letters. A parameter is separated from
its Item or Inner List and other parameters by a semicolon. For its Item or Inner List and other parameters by a semicolon. For
example:</t> example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1.2-5">
Example-List: abc;a=1;b=2; cde_456, (ghi;jk=4 l);q="9";r=w Example-List: abc;a=1;b=2; cde_456, (ghi;jk=4 l);q="9";r=w
</sourcecode> </sourcecode>
<t>Parameters whose value is Boolean (see <xref target="boolean"/>) tr ue <bcp14>MUST</bcp14> omit that value when serialized. For <t indent="0" pn="section-3.1.2-6">Parameters whose value is Boolean ( see <xref target="boolean" format="default" sectionFormat="of" derivedContent="S ection 3.3.6"/>) true <bcp14>MUST</bcp14> omit that value when serialized. For
example, the "a" parameter here is true, while the "b" parameter is example, the "a" parameter here is true, while the "b" parameter is
false:</t> false:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.1.2-7">
Example-Integer: 1; a; b=?0 Example-Integer: 1; a; b=?0
</sourcecode> </sourcecode>
<t>Note that this requirement is only on serialization; parsers are <t indent="0" pn="section-3.1.2-8">Note that this requirement is only on serialization; parsers are
still required to correctly handle the true value when it appears in still required to correctly handle the true value when it appears in
a parameter.</t> a parameter.</t>
<t>Parsers <bcp14>MUST</bcp14> support at least 256 parameters on an I tem or Inner <t indent="0" pn="section-3.1.2-9">Parsers <bcp14>MUST</bcp14> support at least 256 parameters on an Item or Inner
List, and support parameter keys with at least 64 characters. Field List, and support parameter keys with at least 64 characters. Field
specifications can constrain the order of individual parameters, as specifications can constrain the order of individual parameters, as
well as their values' types as required.</t> well as their values' types as required.</t>
</section> </section>
</section> </section>
<section anchor="dictionary"> <section anchor="dictionary" numbered="true" removeInRFC="false" toc="incl
<name>Dictionaries</name> ude" pn="section-3.2">
<t>Dictionaries are ordered maps of name-value pairs, where the names <name slugifiedName="name-dictionaries">Dictionaries</name>
are short textual strings and the values are Items (<xref target="item"/> <t indent="0" pn="section-3.2-1">Dictionaries are ordered maps of name-v
) or arrays of Items, both of which alue pairs, where the names
can be Parameterized (<xref target="param"/>). There are short textual strings and the values are Items (<xref target="item" f
ormat="default" sectionFormat="of" derivedContent="Section 3.3"/>) or arrays of
Items, both of which
can be Parameterized (<xref target="param" format="default" sectionFormat
="of" derivedContent="Section 3.1.2"/>). There
can be zero or more members, and their names are unique in the scope can be zero or more members, and their names are unique in the scope
of the Dictionary they occur within.</t> of the Dictionary they occur within.</t>
<t>Implementations <bcp14>MUST</bcp14> provide access to Dictionaries bo th by index <t indent="0" pn="section-3.2-2">Implementations <bcp14>MUST</bcp14> pro vide access to Dictionaries both by index
and by name. Specifications <bcp14>MAY</bcp14> use either means of access ing the and by name. Specifications <bcp14>MAY</bcp14> use either means of access ing the
members.</t> members.</t>
<t>The ABNF for Dictionaries is:</t> <t indent="0" pn="section-3.2-3">The ABNF for Dictionaries is:</t>
<sourcecode type="abnf"> <sourcecode type="abnf" markers="false" pn="section-3.2-4">
sf-dictionary = dict-member *( OWS "," OWS dict-member ) sf-dictionary = dict-member *( OWS "," OWS dict-member )
dict-member = member-name ( parameters / ( "=" member-value )) dict-member = member-name ( parameters / ( "=" member-value ))
member-name = key member-name = key
member-value = sf-item / inner-list member-value = sf-item / inner-list
</sourcecode> </sourcecode>
<t>Members are ordered as serialized and separated by a comma with <t indent="0" pn="section-3.2-5">Members are ordered as serialized and s eparated by a comma with
optional whitespace. Member names cannot contain uppercase optional whitespace. Member names cannot contain uppercase
characters. Names and values are separated by "=" (without characters. Names and values are separated by "=" (without
whitespace). For example:</t> whitespace). For example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.2-6">
Example-Dict: en="Applepie", da=:w4ZibGV0w6ZydGU=: Example-Dict: en="Applepie", da=:w4ZibGV0w6ZydGU=:
</sourcecode> </sourcecode>
<t>Note that in this example, the final "=" is due to the inclusion of <t indent="0" pn="section-3.2-7">Note that in this example, the final "=
a Byte Sequence; see <xref target="binary"/>.</t> " is due to the inclusion of
<t>Members whose value is Boolean (see <xref target="boolean"/>) true <b a Byte Sequence; see <xref target="binary" format="default" sectionFormat
cp14>MUST</bcp14> omit that value when serialized. For ="of" derivedContent="Section 3.3.5"/>.</t>
<t indent="0" pn="section-3.2-8">Members whose value is Boolean (see <xr
ef target="boolean" format="default" sectionFormat="of" derivedContent="Section
3.3.6"/>) true <bcp14>MUST</bcp14> omit that value when serialized. For
example, here both "b" and "c" are true:</t> example, here both "b" and "c" are true:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.2-9">
Example-Dict: a=?0, b, c; foo=bar Example-Dict: a=?0, b, c; foo=bar
</sourcecode> </sourcecode>
<t>Note that this requirement is only on serialization; parsers are <t indent="0" pn="section-3.2-10">Note that this requirement is only on serialization; parsers are
still required to correctly handle the true Boolean value when it still required to correctly handle the true Boolean value when it
appears in Dictionary values.</t> appears in Dictionary values.</t>
<t>A Dictionary with a member whose value is an Inner List of Tokens:</t <t indent="0" pn="section-3.2-11">A Dictionary with a member whose value
> is an Inner List of Tokens:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.2-12">
Example-Dict: rating=1.5, feelings=(joy sadness) Example-Dict: rating=1.5, feelings=(joy sadness)
</sourcecode> </sourcecode>
<t>A Dictionary with a mix of Items and Inner Lists, some with parameter <t indent="0" pn="section-3.2-13">A Dictionary with a mix of Items and I
s:</t> nner Lists, some with parameters:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.2-14">
Example-Dict: a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid Example-Dict: a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid
</sourcecode> </sourcecode>
<t>As with Lists, an empty Dictionary is represented by omitting the <t indent="0" pn="section-3.2-15">As with Lists, an empty Dictionary is represented by omitting the
entire field. This implies that fields defined as Dictionaries have a entire field. This implies that fields defined as Dictionaries have a
default empty value.</t> default empty value.</t>
<t>Typically, a field specification will define the semantics of <t indent="0" pn="section-3.2-16">Typically, a field specification will define the semantics of
Dictionaries by specifying the allowed type(s) for individual members Dictionaries by specifying the allowed type(s) for individual members
by their names, as well as whether their presence is required or by their names, as well as whether their presence is required or
optional. Recipients <bcp14>MUST</bcp14> ignore names that are undefined or unknown, optional. Recipients <bcp14>MUST</bcp14> ignore names that are undefined or unknown,
unless the field's specification specifically disallows them.</t> unless the field's specification specifically disallows them.</t>
<t>Note that Dictionaries can have their members split across multiple <t indent="0" pn="section-3.2-17">Note that Dictionaries can have their members split across multiple
lines inside a header or trailer section; for example, the following lines inside a header or trailer section; for example, the following
are equivalent:</t> are equivalent:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.2-18">
Example-Dict: foo=1, bar=2 Example-Dict: foo=1, bar=2
</sourcecode> </sourcecode>
<t>and</t> <t indent="0" pn="section-3.2-19">and</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.2-20">
Example-Dict: foo=1 Example-Dict: foo=1
Example-Dict: bar=2 Example-Dict: bar=2
</sourcecode> </sourcecode>
<t>However, individual members of a Dictionary cannot be safely split <t indent="0" pn="section-3.2-21">However, individual members of a Dicti
between lines; see <xref target="text-parse"/> for onary cannot be safely split
between lines; see <xref target="text-parse" format="default" sectionForm
at="of" derivedContent="Section 4.2"/> for
details.</t> details.</t>
<t>Parsers <bcp14>MUST</bcp14> support Dictionaries containing at least 1024 <t indent="0" pn="section-3.2-22">Parsers <bcp14>MUST</bcp14> support Di ctionaries containing at least 1024
name/value pairs and names with at least 64 characters. Field name/value pairs and names with at least 64 characters. Field
specifications can constrain the order of individual Dictionary specifications can constrain the order of individual Dictionary
members, as well as their values' types as required.</t> members, as well as their values' types as required.</t>
</section> </section>
<section anchor="item"> <section anchor="item" numbered="true" removeInRFC="false" toc="include" p
<name>Items</name> n="section-3.3">
<t>An Item can be an Integer (<xref target="integer"/>), a Decimal (<xre <name slugifiedName="name-items">Items</name>
f target="decimal"/>), a String (<xref target="string"/>), a Token (<xref target <t indent="0" pn="section-3.3-1">An Item can be an Integer (<xref target
="token"/>), ="integer" format="default" sectionFormat="of" derivedContent="Section 3.3.1"/>)
a Byte Sequence (<xref target="binary"/>), or a Boolean , a Decimal (<xref target="decimal" format="default" sectionFormat="of" derivedC
(<xref target="boolean"/>). It can have associated ontent="Section 3.3.2"/>), a String (<xref target="string" format="default" sect
parameters (<xref target="param"/>).</t> ionFormat="of" derivedContent="Section 3.3.3"/>), a Token (<xref target="token"
<t>The ABNF for Items is:</t> format="default" sectionFormat="of" derivedContent="Section 3.3.4"/>),
<sourcecode type="abnf"> a Byte Sequence (<xref target="binary" format="default" sectionFormat="of
" derivedContent="Section 3.3.5"/>), or a Boolean
(<xref target="boolean" format="default" sectionFormat="of" derivedConten
t="Section 3.3.6"/>). It can have associated
parameters (<xref target="param" format="default" sectionFormat="of" deri
vedContent="Section 3.1.2"/>).</t>
<t indent="0" pn="section-3.3-2">The ABNF for Items is:</t>
<sourcecode type="abnf" markers="false" pn="section-3.3-3">
sf-item = bare-item parameters sf-item = bare-item parameters
bare-item = sf-integer / sf-decimal / sf-string / sf-token bare-item = sf-integer / sf-decimal / sf-string / sf-token
/ sf-binary / sf-boolean / sf-binary / sf-boolean
</sourcecode> </sourcecode>
<t>For example, a header field that is defined to be an Item that is <t indent="0" pn="section-3.3-4">For example, a header field that is def ined to be an Item that is
an Integer might look like:</t> an Integer might look like:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3-5">
Example-Integer: 5 Example-Integer: 5
</sourcecode> </sourcecode>
<t>or with parameters:</t> <t indent="0" pn="section-3.3-6">or with parameters:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3-7">
Example-Integer: 5; foo=bar Example-Integer: 5; foo=bar
</sourcecode> </sourcecode>
<section anchor="integer"> <section anchor="integer" numbered="true" removeInRFC="false" toc="inclu
<name>Integers</name> de" pn="section-3.3.1">
<t>Integers have a range of -999,999,999,999,999 to <name slugifiedName="name-integers">Integers</name>
<t indent="0" pn="section-3.3.1-1">Integers have a range of -999,999,9
99,999,999 to
999,999,999,999,999 inclusive (i.e., up to fifteen digits, signed), 999,999,999,999,999 inclusive (i.e., up to fifteen digits, signed),
for IEEE 754 compatibility <xref target="IEEE754"/>.</t> for IEEE 754 compatibility <xref target="IEEE754" format="default" sect
<t>The ABNF for Integers is:</t> ionFormat="of" derivedContent="IEEE754"/>.</t>
<sourcecode type="abnf"> <t indent="0" pn="section-3.3.1-2">The ABNF for Integers is:</t>
<sourcecode type="abnf" markers="false" pn="section-3.3.1-3">
sf-integer = ["-"] 1*15DIGIT sf-integer = ["-"] 1*15DIGIT
</sourcecode> </sourcecode>
<t>For example:</t> <t indent="0" pn="section-3.3.1-4">For example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3.1-5">
Example-Integer: 42 Example-Integer: 42
</sourcecode> </sourcecode>
<t>Integers larger than 15 digits can be supported in a variety of <t indent="0" pn="section-3.3.1-6">Integers larger than 15 digits can
ways; for example, by using a String (<xref target="string"/>), a Byte be supported in a variety of
Sequence (<xref target="binary"/>), or a parameter on an Integer that acts as a ways; for example, by using a String (<xref target="string" format="def
ault" sectionFormat="of" derivedContent="Section 3.3.3"/>), a Byte Sequence (<xr
ef target="binary" format="default" sectionFormat="of" derivedContent="Section 3
.3.5"/>), or a parameter on an Integer that acts as a
scaling factor.</t> scaling factor.</t>
<t>While it is possible to serialize Integers with leading zeros <t indent="0" pn="section-3.3.1-7">While it is possible to serialize I ntegers with leading zeros
(e.g., "0002", "-01") and signed zero ("-0"), these distinctions may (e.g., "0002", "-01") and signed zero ("-0"), these distinctions may
not be preserved by implementations.</t> not be preserved by implementations.</t>
<t>Note that commas in Integers are used in this section's prose <t indent="0" pn="section-3.3.1-8">Note that commas in Integers are us ed in this section's prose
only for readability; they are not valid in the wire format.</t> only for readability; they are not valid in the wire format.</t>
</section> </section>
<section anchor="decimal"> <section anchor="decimal" numbered="true" removeInRFC="false" toc="inclu
<name>Decimals</name> de" pn="section-3.3.2">
<t>Decimals are numbers with an integer and a fractional <name slugifiedName="name-decimals">Decimals</name>
<t indent="0" pn="section-3.3.2-1">Decimals are numbers with an intege
r and a fractional
component. The integer component has at most 12 digits; the component. The integer component has at most 12 digits; the
fractional component has at most three digits.</t> fractional component has at most three digits.</t>
<t>The ABNF for decimals is:</t> <t indent="0" pn="section-3.3.2-2">The ABNF for decimals is:</t>
<sourcecode type="abnf"> <sourcecode type="abnf" markers="false" pn="section-3.3.2-3">
sf-decimal = ["-"] 1*12DIGIT "." 1*3DIGIT sf-decimal = ["-"] 1*12DIGIT "." 1*3DIGIT
</sourcecode> </sourcecode>
<t>For example, a header whose value is defined as a Decimal could <t indent="0" pn="section-3.3.2-4">For example, a header whose value i s defined as a Decimal could
look like:</t> look like:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3.2-5">
Example-Decimal: 4.5 Example-Decimal: 4.5
</sourcecode> </sourcecode>
<t>While it is possible to serialize Decimals with leading zeros <t indent="0" pn="section-3.3.2-6">While it is possible to serialize D ecimals with leading zeros
(e.g., "0002.5", "-01.334"), trailing zeros (e.g., "5.230", (e.g., "0002.5", "-01.334"), trailing zeros (e.g., "5.230",
"-0.40"), and signed zero (e.g., "-0.0"), these distinctions may not "-0.40"), and signed zero (e.g., "-0.0"), these distinctions may not
be preserved by implementations.</t> be preserved by implementations.</t>
<t>Note that the serialization algorithm (<xref target="ser-decimal"/> ) rounds input with more than three digits of <t indent="0" pn="section-3.3.2-7">Note that the serialization algorit hm (<xref target="ser-decimal" format="default" sectionFormat="of" derivedConten t="Section 4.1.5"/>) rounds input with more than three digits of
precision in the fractional component. If an alternative rounding precision in the fractional component. If an alternative rounding
strategy is desired, this should be specified by the header strategy is desired, this should be specified by the header
definition to occur before serialization.</t> definition to occur before serialization.</t>
</section> </section>
<section anchor="string"> <section anchor="string" numbered="true" removeInRFC="false" toc="includ
<name>Strings</name> e" pn="section-3.3.3">
<t>Strings are zero or more printable ASCII <xref target="RFC0020"/> c <name slugifiedName="name-strings">Strings</name>
haracters (i.e., the range %x20 to %x7E). Note <t indent="0" pn="section-3.3.3-1">Strings are zero or more printable
ASCII <xref target="RFC0020" format="default" sectionFormat="of" derivedContent=
"RFC0020"/> characters (i.e., the range %x20 to %x7E). Note
that this excludes tabs, newlines, carriage returns, etc.</t> that this excludes tabs, newlines, carriage returns, etc.</t>
<t>The ABNF for Strings is:</t> <t indent="0" pn="section-3.3.3-2">The ABNF for Strings is:</t>
<sourcecode type="abnf"> <sourcecode type="abnf" markers="false" pn="section-3.3.3-3">
sf-string = DQUOTE *chr DQUOTE sf-string = DQUOTE *chr DQUOTE
chr = unescaped / escaped chr = unescaped / escaped
unescaped = %x20-21 / %x23-5B / %x5D-7E unescaped = %x20-21 / %x23-5B / %x5D-7E
escaped = "\" ( DQUOTE / "\" ) escaped = "\" ( DQUOTE / "\" )
</sourcecode> </sourcecode>
<t>Strings are delimited with double quotes, using a backslash ("\") <t indent="0" pn="section-3.3.3-4">Strings are delimited with double q uotes, using a backslash ("\")
to escape double quotes and backslashes. For example:</t> to escape double quotes and backslashes. For example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3.3-5">
Example-String: "hello world" Example-String: "hello world"
</sourcecode> </sourcecode>
<t>Note that Strings only use DQUOTE as a delimiter; single quotes <t indent="0" pn="section-3.3.3-6">Note that Strings only use DQUOTE a s a delimiter; single quotes
do not delimit Strings. Furthermore, only DQUOTE and "\" can be do not delimit Strings. Furthermore, only DQUOTE and "\" can be
escaped; other characters after "\" <bcp14>MUST</bcp14> cause parsing t o fail.</t> escaped; other characters after "\" <bcp14>MUST</bcp14> cause parsing t o fail.</t>
<t>Unicode is not directly supported in Strings, because it causes a <t indent="0" pn="section-3.3.3-7">Unicode is not directly supported i n Strings, because it causes a
number of interoperability issues, and -- with few exceptions -- field number of interoperability issues, and -- with few exceptions -- field
values do not require it.</t> values do not require it.</t>
<t>When it is necessary for a field value to convey non-ASCII <t indent="0" pn="section-3.3.3-8">When it is necessary for a field va
content, a Byte Sequence (<xref target="binary"/>) lue to convey non-ASCII
can be specified, along with a character encoding (preferably <xref tar content, a Byte Sequence (<xref target="binary" format="default" sectio
get="STD63"/>).</t> nFormat="of" derivedContent="Section 3.3.5"/>)
<t>Parsers <bcp14>MUST</bcp14> support Strings (after any decoding) wi can be specified, along with a character encoding (preferably <xref tar
th at least get="STD63" format="default" sectionFormat="of" derivedContent="STD63"/>).</t>
<t indent="0" pn="section-3.3.3-9">Parsers <bcp14>MUST</bcp14> support
Strings (after any decoding) with at least
1024 characters.</t> 1024 characters.</t>
</section> </section>
<section anchor="token"> <section anchor="token" numbered="true" removeInRFC="false" toc="include
<name>Tokens</name> " pn="section-3.3.4">
<t>Tokens are short textual words; their abstract model is identical <name slugifiedName="name-tokens">Tokens</name>
<t indent="0" pn="section-3.3.4-1">Tokens are short textual words; the
ir abstract model is identical
to their expression in the HTTP field value serialization.</t> to their expression in the HTTP field value serialization.</t>
<t>The ABNF for Tokens is:</t> <t indent="0" pn="section-3.3.4-2">The ABNF for Tokens is:</t>
<sourcecode type="abnf"> <sourcecode type="abnf" markers="false" pn="section-3.3.4-3">
sf-token = ( ALPHA / "*" ) *( tchar / ":" / "/" ) sf-token = ( ALPHA / "*" ) *( tchar / ":" / "/" )
</sourcecode> </sourcecode>
<t>For example:</t> <t indent="0" pn="section-3.3.4-4">For example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3.4-5">
Example-Token: foo123/456 Example-Token: foo123/456
</sourcecode> </sourcecode>
<t>Parsers <bcp14>MUST</bcp14> support Tokens with at least 512 charac <t indent="0" pn="section-3.3.4-6">Parsers <bcp14>MUST</bcp14> support
ters.</t> Tokens with at least 512 characters.</t>
<t>Note that Token allows the same characters as the "token" ABNF <t indent="0" pn="section-3.3.4-7">Note that Token allows the same cha
rule defined in <xref target="RFC7230"/>, with the racters as the "token" ABNF
rule defined in <xref target="RFC7230" format="default" sectionFormat="
of" derivedContent="RFC7230"/>, with the
exceptions that the first character is required to be either ALPHA exceptions that the first character is required to be either ALPHA
or "*", and ":" and "/" are also allowed in subsequent or "*", and ":" and "/" are also allowed in subsequent
characters.</t> characters.</t>
</section> </section>
<section anchor="binary"> <section anchor="binary" numbered="true" removeInRFC="false" toc="includ
<name>Byte Sequences</name> e" pn="section-3.3.5">
<t>Byte Sequences can be conveyed in Structured Fields.</t> <name slugifiedName="name-byte-sequences">Byte Sequences</name>
<t>The ABNF for a Byte Sequence is:</t> <t indent="0" pn="section-3.3.5-1">Byte Sequences can be conveyed in S
<sourcecode type="abnf"> tructured Fields.</t>
<t indent="0" pn="section-3.3.5-2">The ABNF for a Byte Sequence is:</t
>
<sourcecode type="abnf" markers="false" pn="section-3.3.5-3">
sf-binary = ":" *(base64) ":" sf-binary = ":" *(base64) ":"
base64 = ALPHA / DIGIT / "+" / "/" / "=" base64 = ALPHA / DIGIT / "+" / "/" / "="
</sourcecode> </sourcecode>
<t>A Byte Sequence is delimited with colons and encoded using base64 <t indent="0" pn="section-3.3.5-4">A Byte Sequence is delimited with c
(<xref target="RFC4648" sectionFormat="comma" section="4"/>). For olons and encoded using base64
(<xref target="RFC4648" sectionFormat="comma" section="4" format="defau
lt" derivedLink="https://rfc-editor.org/rfc/rfc4648#section-4" derivedContent="R
FC4648"/>). For
example:</t> example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3.5-5">
Example-ByteSequence: :cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg==: Example-ByteSequence: :cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg==:
</sourcecode> </sourcecode>
<t>Parsers <bcp14>MUST</bcp14> support Byte Sequences with at least 16 384 octets <t indent="0" pn="section-3.3.5-6">Parsers <bcp14>MUST</bcp14> support Byte Sequences with at least 16384 octets
after decoding.</t> after decoding.</t>
</section> </section>
<section anchor="boolean"> <section anchor="boolean" numbered="true" removeInRFC="false" toc="inclu
<name>Booleans</name> de" pn="section-3.3.6">
<t>Boolean values can be conveyed in Structured Fields.</t> <name slugifiedName="name-booleans">Booleans</name>
<t>The ABNF for a Boolean is:</t> <t indent="0" pn="section-3.3.6-1">Boolean values can be conveyed in S
<sourcecode type="abnf"> tructured Fields.</t>
<t indent="0" pn="section-3.3.6-2">The ABNF for a Boolean is:</t>
<sourcecode type="abnf" markers="false" pn="section-3.3.6-3">
sf-boolean = "?" boolean sf-boolean = "?" boolean
boolean = "0" / "1" boolean = "0" / "1"
</sourcecode> </sourcecode>
<t>A Boolean is indicated with a leading "?" character followed by a <t indent="0" pn="section-3.3.6-4">A Boolean is indicated with a leadi ng "?" character followed by a
"1" for a true value or "0" for false. For example:</t> "1" for a true value or "0" for false. For example:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-3.3.6-5">
Example-Boolean: ?1 Example-Boolean: ?1
</sourcecode> </sourcecode>
<t>Note that in Dictionary (<xref target="dictionary"/>) and Parameter (<xref target="param"/>) values, Boolean true is indicated by omitting <t indent="0" pn="section-3.3.6-6">Note that in Dictionary (<xref targ et="dictionary" format="default" sectionFormat="of" derivedContent="Section 3.2" />) and Parameter (<xref target="param" format="default" sectionFormat="of" deri vedContent="Section 3.1.2"/>) values, Boolean true is indicated by omitting
the value.</t> the value.</t>
</section> </section>
</section> </section>
</section> </section>
<section anchor="text"> <section anchor="text" numbered="true" removeInRFC="false" toc="include" pn=
<name>Working with Structured Fields in HTTP</name> "section-4">
<t>This section defines how to serialize and parse Structured Fields in <name slugifiedName="name-working-with-structured-fie">Working with Struct
ured Fields in HTTP</name>
<t indent="0" pn="section-4-1">This section defines how to serialize and p
arse Structured Fields in
textual HTTP field values and other encodings compatible with them textual HTTP field values and other encodings compatible with them
(e.g., in HTTP/2 <xref target="RFC7540"/> before (e.g., in HTTP/2 <xref target="RFC7540" format="default" sectionFormat="of
compression with HPACK <xref target="RFC7541"/>).</t> " derivedContent="RFC7540"/> before
<section anchor="text-serialize"> compression with HPACK <xref target="RFC7541" format="default" sectionForm
<name>Serializing Structured Fields</name> at="of" derivedContent="RFC7541"/>).</t>
<t>Given a structure defined in this specification, return an ASCII <section anchor="text-serialize" numbered="true" removeInRFC="false" toc="
include" pn="section-4.1">
<name slugifiedName="name-serializing-structured-fiel">Serializing Struc
tured Fields</name>
<t indent="0" pn="section-4.1-1">Given a structure defined in this speci
fication, return an ASCII
string suitable for use in an HTTP field value.</t> string suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-4.
<li>If the structure is a Dictionary or List and its value is empty 1-2">
<li pn="section-4.1-2.1" derivedCounter="1.">If the structure is a Dic
tionary or List and its value is empty
(i.e., it has no members), do not serialize the field at all (i.e., (i.e., it has no members), do not serialize the field at all (i.e.,
omit both the field-name and field-value).</li> omit both the field-name and field-value).</li>
<li>If the structure is a List, let output_string be the result of <li pn="section-4.1-2.2" derivedCounter="2.">If the structure is a Lis
running Serializing a List (<xref target="ser-list"/>) with the structu t, let output_string be the result of
re.</li> running Serializing a List (<xref target="ser-list" format="default" se
<li>Else, if the structure is a Dictionary, let output_string be the ctionFormat="of" derivedContent="Section 4.1.1"/>) with the structure.</li>
result of running Serializing a Dictionary (<xref target="ser-dictionar <li pn="section-4.1-2.3" derivedCounter="3.">Else, if the structure is
y"/>) with the structure.</li> a Dictionary, let output_string be the
<li>Else, if the structure is an Item, let output_string be the result of running Serializing a Dictionary (<xref target="ser-dictionar
result of running Serializing an Item (<xref target="ser-item"/>) with y" format="default" sectionFormat="of" derivedContent="Section 4.1.2"/>) with th
the structure.</li> e structure.</li>
<li>Else, fail serialization.</li> <li pn="section-4.1-2.4" derivedCounter="4.">Else, if the structure is
<li>Return output_string converted into an array of bytes, using an Item, let output_string be the
ASCII encoding <xref target="RFC0020"/>.</li> result of running Serializing an Item (<xref target="ser-item" format="
default" sectionFormat="of" derivedContent="Section 4.1.3"/>) with the structure
.</li>
<li pn="section-4.1-2.5" derivedCounter="5.">Else, fail serialization.
</li>
<li pn="section-4.1-2.6" derivedCounter="6.">Return output_string conv
erted into an array of bytes, using
ASCII encoding <xref target="RFC0020" format="default" sectionFormat="o
f" derivedContent="RFC0020"/>.</li>
</ol> </ol>
<section anchor="ser-list"> <section anchor="ser-list" numbered="true" removeInRFC="false" toc="incl
<name>Serializing a List</name> ude" pn="section-4.1.1">
<t>Given an array of (member_value, parameters) tuples as <name slugifiedName="name-serializing-a-list">Serializing a List</name
>
<t indent="0" pn="section-4.1.1-1">Given an array of (member_value, pa
rameters) tuples as
input_list, return an ASCII string suitable for use in an HTTP field input_list, return an ASCII string suitable for use in an HTTP field
value.</t> value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let output be an empty string.</li> 4.1.1-2">
<li> <li pn="section-4.1.1-2.1" derivedCounter="1.">Let output be an empt
<t>For each (member_value, parameters) of input_list: y string.</li>
<li pn="section-4.1.1-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.1.1-2.2.1">For each (member_value, par
ameters) of input_list:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>If member_value is an array, append the result of running ion-4.1.1-2.2.2">
Serializing an Inner List (<xref target="ser-innerlist"/>) with ( <li pn="section-4.1.1-2.2.2.1" derivedCounter="1.">If member_val
member_value, parameters) to ue is an array, append the result of running
Serializing an Inner List (<xref target="ser-innerlist" format="d
efault" sectionFormat="of" derivedContent="Section 4.1.1.1"/>) with (member_valu
e, parameters) to
output.</li> output.</li>
<li>Otherwise, append the result of running Serializing an <li pn="section-4.1.1-2.2.2.2" derivedCounter="2.">Otherwise, ap
Item (<xref target="ser-item"/>) with pend the result of running Serializing an
Item (<xref target="ser-item" format="default" sectionFormat="of"
derivedContent="Section 4.1.3"/>) with
(member_value, parameters) to output.</li> (member_value, parameters) to output.</li>
<li> <li pn="section-4.1.1-2.2.2.3" derivedCounter="3.">
<t>If more member_values remain in input_list: <t indent="0" pn="section-4.1.1-2.2.2.3.1">If more member_valu
es remain in input_list:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Append "," to output.</li> section-4.1.1-2.2.2.3.2">
<li>Append a single SP to output.</li> <li pn="section-4.1.1-2.2.2.3.2.1" derivedCounter="1.">Appen
d "," to output.</li>
<li pn="section-4.1.1-2.2.2.3.2.2" derivedCounter="2.">Appen
d a single SP to output.</li>
</ol> </ol>
</li> </li>
</ol> </ol>
</li> </li>
<li>Return output.</li> <li pn="section-4.1.1-2.3" derivedCounter="3.">Return output.</li>
</ol> </ol>
<section anchor="ser-innerlist"> <section anchor="ser-innerlist" numbered="true" removeInRFC="false" to
<name>Serializing an Inner List</name> c="exclude" pn="section-4.1.1.1">
<t>Given an array of (member_value, parameters) tuples as <name slugifiedName="name-serializing-an-inner-list">Serializing an
Inner List</name>
<t indent="0" pn="section-4.1.1.1-1">Given an array of (member_value
, parameters) tuples as
inner_list, and parameters as list_parameters, return an ASCII inner_list, and parameters as list_parameters, return an ASCII
string suitable for use in an HTTP field value.</t> string suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>Let output be the string "(".</li> n-4.1.1.1-2">
<li> <li pn="section-4.1.1.1-2.1" derivedCounter="1.">Let output be the
<t>For each (member_value, parameters) of inner_list: string "(".</li>
<li pn="section-4.1.1.1-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.1.1.1-2.2.1">For each (member_value,
parameters) of inner_list:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="se
<li>Append the result of running Serializing an Item (<xref ta ction-4.1.1.1-2.2.2">
rget="ser-item"/>) with (member_value, <li pn="section-4.1.1.1-2.2.2.1" derivedCounter="1.">Append th
e result of running Serializing an Item (<xref target="ser-item" format="default
" sectionFormat="of" derivedContent="Section 4.1.3"/>) with (member_value,
parameters) to output.</li> parameters) to output.</li>
<li>If more values remain in inner_list, append a single SP to output.</li> <li pn="section-4.1.1.1-2.2.2.2" derivedCounter="2.">If more v alues remain in inner_list, append a single SP to output.</li>
</ol> </ol>
</li> </li>
<li>Append ")" to output.</li> <li pn="section-4.1.1.1-2.3" derivedCounter="3.">Append ")" to out
<li>Append the result of running Serializing Parameters (<xref tar put.</li>
get="ser-params"/>) with list_parameters to <li pn="section-4.1.1.1-2.4" derivedCounter="4.">Append the result
of running Serializing Parameters (<xref target="ser-params" format="default" s
ectionFormat="of" derivedContent="Section 4.1.1.2"/>) with list_parameters to
output.</li> output.</li>
<li>Return output.</li> <li pn="section-4.1.1.1-2.5" derivedCounter="5.">Return output.</l i>
</ol> </ol>
</section> </section>
<section anchor="ser-params"> <section anchor="ser-params" numbered="true" removeInRFC="false" toc="
<name>Serializing Parameters</name> exclude" pn="section-4.1.1.2">
<t>Given an ordered Dictionary as input_parameters (each member <name slugifiedName="name-serializing-parameters">Serializing Parame
ters</name>
<t indent="0" pn="section-4.1.1.2-1">Given an ordered Dictionary as
input_parameters (each member
having a param_name and a param_value), return an ASCII string having a param_name and a param_value), return an ASCII string
suitable for use in an HTTP field value.</t> suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>Let output be an empty string.</li> n-4.1.1.2-2">
<li> <li pn="section-4.1.1.2-2.1" derivedCounter="1.">Let output be an
<t>For each param_name with a value of param_value in input_para empty string.</li>
meters: <li pn="section-4.1.1.2-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.1.1.2-2.2.1">For each param_name wit
h a value of param_value in input_parameters:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="se
<li>Append ";" to output.</li> ction-4.1.1.2-2.2.2">
<li>Append the result of running Serializing a Key (<xref targ <li pn="section-4.1.1.2-2.2.2.1" derivedCounter="1.">Append ";
et="ser-key"/>) with param_name to " to output.</li>
<li pn="section-4.1.1.2-2.2.2.2" derivedCounter="2.">Append th
e result of running Serializing a Key (<xref target="ser-key" format="default" s
ectionFormat="of" derivedContent="Section 4.1.1.3"/>) with param_name to
output.</li> output.</li>
<li> <li pn="section-4.1.1.2-2.2.2.3" derivedCounter="3.">
<t>If param_value is not Boolean true: <t indent="0" pn="section-4.1.1.2-2.2.2.3.1">If param_value
is not Boolean true:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn
<li>Append "=" to output.</li> ="section-4.1.1.2-2.2.2.3.2">
<li>Append the result of running Serializing a bare Item <li pn="section-4.1.1.2-2.2.2.3.2.1" derivedCounter="1.">A
(<xref target="ser-bare-item"/>) with ppend "=" to output.</li>
<li pn="section-4.1.1.2-2.2.2.3.2.2" derivedCounter="2.">A
ppend the result of running Serializing a bare Item
(<xref target="ser-bare-item" format="default" sectionForma
t="of" derivedContent="Section 4.1.3.1"/>) with
param_value to output.</li> param_value to output.</li>
</ol> </ol>
</li> </li>
</ol> </ol>
</li> </li>
<li>Return output.</li> <li pn="section-4.1.1.2-2.3" derivedCounter="3.">Return output.</l i>
</ol> </ol>
</section> </section>
<section anchor="ser-key"> <section anchor="ser-key" numbered="true" removeInRFC="false" toc="exc
<name>Serializing a Key</name> lude" pn="section-4.1.1.3">
<t>Given a key as input_key, return an ASCII string suitable for <name slugifiedName="name-serializing-a-key">Serializing a Key</name
>
<t indent="0" pn="section-4.1.1.3-1">Given a key as input_key, retur
n an ASCII string suitable for
use in an HTTP field value.</t> use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>Convert input_key into a sequence of ASCII characters; if n-4.1.1.3-2">
<li pn="section-4.1.1.3-2.1" derivedCounter="1.">Convert input_key
into a sequence of ASCII characters; if
conversion fails, fail serialization.</li> conversion fails, fail serialization.</li>
<li>If input_key contains characters not in lcalpha, DIGIT, "_", <li pn="section-4.1.1.3-2.2" derivedCounter="2.">If input_key cont ains characters not in lcalpha, DIGIT, "_",
"-", ".", or "*", fail serialization.</li> "-", ".", or "*", fail serialization.</li>
<li>If the first character of input_key is not lcalpha or "*", <li pn="section-4.1.1.3-2.3" derivedCounter="3.">If the first char acter of input_key is not lcalpha or "*",
fail serialization.</li> fail serialization.</li>
<li>Let output be an empty string.</li> <li pn="section-4.1.1.3-2.4" derivedCounter="4.">Let output be an
<li>Append input_key to output.</li> empty string.</li>
<li>Return output.</li> <li pn="section-4.1.1.3-2.5" derivedCounter="5.">Append input_key
to output.</li>
<li pn="section-4.1.1.3-2.6" derivedCounter="6.">Return output.</l
i>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="ser-dictionary"> <section anchor="ser-dictionary" numbered="true" removeInRFC="false" toc
<name>Serializing a Dictionary</name> ="include" pn="section-4.1.2">
<t>Given an ordered Dictionary as input_dictionary (each member <name slugifiedName="name-serializing-a-dictionary">Serializing a Dict
ionary</name>
<t indent="0" pn="section-4.1.2-1">Given an ordered Dictionary as inpu
t_dictionary (each member
having a member_name and a tuple value of (member_value, having a member_name and a tuple value of (member_value,
parameters)), return an ASCII string suitable for use in an HTTP parameters)), return an ASCII string suitable for use in an HTTP
field value.</t> field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let output be an empty string.</li> 4.1.2-2">
<li> <li pn="section-4.1.2-2.1" derivedCounter="1.">Let output be an empt
<t>For each member_name with a value of (member_value, parameters) y string.</li>
in input_dictionary: <li pn="section-4.1.2-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.1.2-2.2.1">For each member_name with a
value of (member_value, parameters) in input_dictionary:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>Append the result of running Serializing a Key (<xref target ion-4.1.2-2.2.2">
="ser-key"/>) with member's member_name <li pn="section-4.1.2-2.2.2.1" derivedCounter="1.">Append the re
sult of running Serializing a Key (<xref target="ser-key" format="default" secti
onFormat="of" derivedContent="Section 4.1.1.3"/>) with member's member_name
to output.</li> to output.</li>
<li> <li pn="section-4.1.2-2.2.2.2" derivedCounter="2.">
<t>If member_value is Boolean true: <t indent="0" pn="section-4.1.2-2.2.2.2.1">If member_value is
Boolean true:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Append the result of running Serializing Parameters section-4.1.2-2.2.2.2.2">
(<xref target="ser-params"/>) with <li pn="section-4.1.2-2.2.2.2.2.1" derivedCounter="1.">Appen
d the result of running Serializing Parameters
(<xref target="ser-params" format="default" sectionFormat="of
" derivedContent="Section 4.1.1.2"/>) with
parameters to output.</li> parameters to output.</li>
</ol> </ol>
</li> </li>
<li> <li pn="section-4.1.2-2.2.2.3" derivedCounter="3.">
<t>Otherwise: <t indent="0" pn="section-4.1.2-2.2.2.3.1">Otherwise:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Append "=" to output.</li> section-4.1.2-2.2.2.3.2">
<li>If member_value is an array, append the result of <li pn="section-4.1.2-2.2.2.3.2.1" derivedCounter="1.">Appen
running Serializing an Inner List (<xref target="ser-innerlis d "=" to output.</li>
t"/>) with <li pn="section-4.1.2-2.2.2.3.2.2" derivedCounter="2.">If me
mber_value is an array, append the result of
running Serializing an Inner List (<xref target="ser-innerlis
t" format="default" sectionFormat="of" derivedContent="Section 4.1.1.1"/>) with
(member_value, parameters) to output.</li> (member_value, parameters) to output.</li>
<li>Otherwise, append the result of running Serializing an <li pn="section-4.1.2-2.2.2.3.2.3" derivedCounter="3.">Other
Item (<xref target="ser-item"/>) with wise, append the result of running Serializing an
Item (<xref target="ser-item" format="default" sectionFormat=
"of" derivedContent="Section 4.1.3"/>) with
(member_value, parameters) to output.</li> (member_value, parameters) to output.</li>
</ol> </ol>
</li> </li>
<li> <li pn="section-4.1.2-2.2.2.4" derivedCounter="4.">
<t>If more members remain in input_dictionary: <t indent="0" pn="section-4.1.2-2.2.2.4.1">If more members rem
ain in input_dictionary:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Append "," to output.</li> section-4.1.2-2.2.2.4.2">
<li>Append a single SP to output.</li> <li pn="section-4.1.2-2.2.2.4.2.1" derivedCounter="1.">Appen
d "," to output.</li>
<li pn="section-4.1.2-2.2.2.4.2.2" derivedCounter="2.">Appen
d a single SP to output.</li>
</ol> </ol>
</li> </li>
</ol> </ol>
</li> </li>
<li>Return output.</li> <li pn="section-4.1.2-2.3" derivedCounter="3.">Return output.</li>
</ol> </ol>
</section> </section>
<section anchor="ser-item"> <section anchor="ser-item" numbered="true" removeInRFC="false" toc="incl
<name>Serializing an Item</name> ude" pn="section-4.1.3">
<t>Given an Item as bare_item and Parameters as item_parameters, <name slugifiedName="name-serializing-an-item">Serializing an Item</na
me>
<t indent="0" pn="section-4.1.3-1">Given an Item as bare_item and Para
meters as item_parameters,
return an ASCII string suitable for use in an HTTP field value.</t> return an ASCII string suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let output be an empty string.</li> 4.1.3-2">
<li>Append the result of running Serializing a Bare Item (<xref targ <li pn="section-4.1.3-2.1" derivedCounter="1.">Let output be an empt
et="ser-bare-item"/>) with bare_item to y string.</li>
<li pn="section-4.1.3-2.2" derivedCounter="2.">Append the result of
running Serializing a Bare Item (<xref target="ser-bare-item" format="default" s
ectionFormat="of" derivedContent="Section 4.1.3.1"/>) with bare_item to
output.</li> output.</li>
<li>Append the result of running Serializing Parameters (<xref targe t="ser-params"/>) with item_parameters to <li pn="section-4.1.3-2.3" derivedCounter="3.">Append the result of running Serializing Parameters (<xref target="ser-params" format="default" secti onFormat="of" derivedContent="Section 4.1.1.2"/>) with item_parameters to
output.</li> output.</li>
<li>Return output.</li> <li pn="section-4.1.3-2.4" derivedCounter="4.">Return output.</li>
</ol> </ol>
<section anchor="ser-bare-item"> <section anchor="ser-bare-item" numbered="true" removeInRFC="false" to
<name>Serializing a Bare Item</name> c="exclude" pn="section-4.1.3.1">
<t>Given an Item as input_item, return an ASCII string suitable <name slugifiedName="name-serializing-a-bare-item">Serializing a Bar
e Item</name>
<t indent="0" pn="section-4.1.3.1-1">Given an Item as input_item, re
turn an ASCII string suitable
for use in an HTTP field value.</t> for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>If input_item is an Integer, return the result of running n-4.1.3.1-2">
Serializing an Integer (<xref target="ser-integer"/>) with input_it <li pn="section-4.1.3.1-2.1" derivedCounter="1.">If input_item is
em.</li> an Integer, return the result of running
<li>If input_item is a Decimal, return the result of running Serializing an Integer (<xref target="ser-integer" format="default"
Serializing a Decimal (<xref target="ser-decimal"/>) with input_ite sectionFormat="of" derivedContent="Section 4.1.4"/>) with input_item.</li>
m.</li> <li pn="section-4.1.3.1-2.2" derivedCounter="2.">If input_item is
<li>If input_item is a String, return the result of running a Decimal, return the result of running
Serializing a String (<xref target="ser-string"/>) with input_item. Serializing a Decimal (<xref target="ser-decimal" format="default"
</li> sectionFormat="of" derivedContent="Section 4.1.5"/>) with input_item.</li>
<li>If input_item is a Token, return the result of running <li pn="section-4.1.3.1-2.3" derivedCounter="3.">If input_item is
Serializing a Token (<xref target="ser-token"/>) with input_item.</ a String, return the result of running
li> Serializing a String (<xref target="ser-string" format="default" se
<li>If input_item is a Byte Sequence, return the result of ctionFormat="of" derivedContent="Section 4.1.6"/>) with input_item.</li>
running Serializing a Byte Sequence (<xref target="ser-binary"/>) w <li pn="section-4.1.3.1-2.4" derivedCounter="4.">If input_item is
ith input_item.</li> a Token, return the result of running
<li>If input_item is a Boolean, return the result of running Serializing a Token (<xref target="ser-token" format="default" sect
Serializing a Boolean (<xref target="ser-boolean"/>) with ionFormat="of" derivedContent="Section 4.1.7"/>) with input_item.</li>
<li pn="section-4.1.3.1-2.5" derivedCounter="5.">If input_item is
a Byte Sequence, return the result of
running Serializing a Byte Sequence (<xref target="ser-binary" form
at="default" sectionFormat="of" derivedContent="Section 4.1.8"/>) with input_ite
m.</li>
<li pn="section-4.1.3.1-2.6" derivedCounter="6.">If input_item is
a Boolean, return the result of running
Serializing a Boolean (<xref target="ser-boolean" format="default"
sectionFormat="of" derivedContent="Section 4.1.9"/>) with
input_item.</li> input_item.</li>
<li>Otherwise, fail serialization.</li> <li pn="section-4.1.3.1-2.7" derivedCounter="7.">Otherwise, fail s
erialization.</li>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="ser-integer"> <section anchor="ser-integer" numbered="true" removeInRFC="false" toc="i
<name>Serializing an Integer</name> nclude" pn="section-4.1.4">
<t>Given an Integer as input_integer, return an ASCII string <name slugifiedName="name-serializing-an-integer">Serializing an Integ
er</name>
<t indent="0" pn="section-4.1.4-1">Given an Integer as input_integer,
return an ASCII string
suitable for use in an HTTP field value.</t> suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If input_integer is not an integer in the range of 4.1.4-2">
<li pn="section-4.1.4-2.1" derivedCounter="1.">If input_integer is n
ot an integer in the range of
-999,999,999,999,999 to 999,999,999,999,999 inclusive, fail -999,999,999,999,999 to 999,999,999,999,999 inclusive, fail
serialization.</li> serialization.</li>
<li>Let output be an empty string.</li> <li pn="section-4.1.4-2.2" derivedCounter="2.">Let output be an empt
<li>If input_integer is less than (but not equal to) 0, append "-" y string.</li>
<li pn="section-4.1.4-2.3" derivedCounter="3.">If input_integer is l
ess than (but not equal to) 0, append "-"
to output.</li> to output.</li>
<li>Append input_integer's numeric value represented in base 10 <li pn="section-4.1.4-2.4" derivedCounter="4.">Append input_integer' s numeric value represented in base 10
using only decimal digits to output.</li> using only decimal digits to output.</li>
<li>Return output.</li> <li pn="section-4.1.4-2.5" derivedCounter="5.">Return output.</li>
</ol> </ol>
</section> </section>
<section anchor="ser-decimal"> <section anchor="ser-decimal" numbered="true" removeInRFC="false" toc="i
<name>Serializing a Decimal</name> nclude" pn="section-4.1.5">
<t>Given a decimal number as input_decimal, return an ASCII string <name slugifiedName="name-serializing-a-decimal">Serializing a Decimal
</name>
<t indent="0" pn="section-4.1.5-1">Given a decimal number as input_dec
imal, return an ASCII string
suitable for use in an HTTP field value.</t> suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If input_decimal is not a decimal number, fail serialization.</l 4.1.5-2">
i> <li pn="section-4.1.5-2.1" derivedCounter="1.">If input_decimal is n
<li>If input_decimal has more than three significant digits to the ot a decimal number, fail serialization.</li>
<li pn="section-4.1.5-2.2" derivedCounter="2.">If input_decimal has
more than three significant digits to the
right of the decimal point, round it to three decimal places, right of the decimal point, round it to three decimal places,
rounding the final digit to the nearest value, or to the even rounding the final digit to the nearest value, or to the even
value if it is equidistant.</li> value if it is equidistant.</li>
<li>If input_decimal has more than 12 significant digits to the <li pn="section-4.1.5-2.3" derivedCounter="3.">If input_decimal has more than 12 significant digits to the
left of the decimal point after rounding, fail serialization.</li> left of the decimal point after rounding, fail serialization.</li>
<li>Let output be an empty string.</li> <li pn="section-4.1.5-2.4" derivedCounter="4.">Let output be an empt
<li>If input_decimal is less than (but not equal to) 0, append "-" y string.</li>
<li pn="section-4.1.5-2.5" derivedCounter="5.">If input_decimal is l
ess than (but not equal to) 0, append "-"
to output.</li> to output.</li>
<li>Append input_decimal's integer component represented in base <li pn="section-4.1.5-2.6" derivedCounter="6.">Append input_decimal' s integer component represented in base
10 (using only decimal digits) to output; if it is zero, append 10 (using only decimal digits) to output; if it is zero, append
"0".</li> "0".</li>
<li>Append "." to output.</li> <li pn="section-4.1.5-2.7" derivedCounter="7.">Append "." to output.
<li>If input_decimal's fractional component is zero, append "0" to </li>
<li pn="section-4.1.5-2.8" derivedCounter="8.">If input_decimal's fr
actional component is zero, append "0" to
output.</li> output.</li>
<li>Otherwise, append the significant digits of input_decimal's <li pn="section-4.1.5-2.9" derivedCounter="9.">Otherwise, append the significant digits of input_decimal's
fractional component represented in base 10 (using only decimal fractional component represented in base 10 (using only decimal
digits) to output.</li> digits) to output.</li>
<li>Return output.</li> <li pn="section-4.1.5-2.10" derivedCounter="10.">Return output.</li>
</ol> </ol>
</section> </section>
<section anchor="ser-string"> <section anchor="ser-string" numbered="true" removeInRFC="false" toc="in
<name>Serializing a String</name> clude" pn="section-4.1.6">
<t>Given a String as input_string, return an ASCII string suitable <name slugifiedName="name-serializing-a-string">Serializing a String</
name>
<t indent="0" pn="section-4.1.6-1">Given a String as input_string, ret
urn an ASCII string suitable
for use in an HTTP field value.</t> for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Convert input_string into a sequence of ASCII characters; if 4.1.6-2">
<li pn="section-4.1.6-2.1" derivedCounter="1.">Convert input_string
into a sequence of ASCII characters; if
conversion fails, fail serialization.</li> conversion fails, fail serialization.</li>
<li>If input_string contains characters in the range %x00-1f or <li pn="section-4.1.6-2.2" derivedCounter="2.">If input_string conta ins characters in the range %x00-1f or
%x7f (i.e., not in VCHAR or SP), fail serialization.</li> %x7f (i.e., not in VCHAR or SP), fail serialization.</li>
<li>Let output be the string DQUOTE.</li> <li pn="section-4.1.6-2.3" derivedCounter="3.">Let output be the str
<li> ing DQUOTE.</li>
<t>For each character char in input_string: <li pn="section-4.1.6-2.4" derivedCounter="4.">
<t indent="0" pn="section-4.1.6-2.4.1">For each character char in
input_string:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li> ion-4.1.6-2.4.2">
<t>If char is "\" or DQUOTE: <li pn="section-4.1.6-2.4.2.1" derivedCounter="1.">
<t indent="0" pn="section-4.1.6-2.4.2.1.1">If char is "\" or D
QUOTE:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Append "\" to output.</li> section-4.1.6-2.4.2.1.2">
<li pn="section-4.1.6-2.4.2.1.2.1" derivedCounter="1.">Appen
d "\" to output.</li>
</ol> </ol>
</li> </li>
<li>Append char to output.</li> <li pn="section-4.1.6-2.4.2.2" derivedCounter="2.">Append char t o output.</li>
</ol> </ol>
</li> </li>
<li>Append DQUOTE to output.</li> <li pn="section-4.1.6-2.5" derivedCounter="5.">Append DQUOTE to outp
<li>Return output.</li> ut.</li>
<li pn="section-4.1.6-2.6" derivedCounter="6.">Return output.</li>
</ol> </ol>
</section> </section>
<section anchor="ser-token"> <section anchor="ser-token" numbered="true" removeInRFC="false" toc="inc
<name>Serializing a Token</name> lude" pn="section-4.1.7">
<t>Given a Token as input_token, return an ASCII string suitable for <name slugifiedName="name-serializing-a-token">Serializing a Token</na
me>
<t indent="0" pn="section-4.1.7-1">Given a Token as input_token, retur
n an ASCII string suitable for
use in an HTTP field value.</t> use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Convert input_token into a sequence of ASCII characters; if 4.1.7-2">
<li pn="section-4.1.7-2.1" derivedCounter="1.">Convert input_token i
nto a sequence of ASCII characters; if
conversion fails, fail serialization.</li> conversion fails, fail serialization.</li>
<li>If the first character of input_token is not ALPHA or "*", or <li pn="section-4.1.7-2.2" derivedCounter="2.">If the first characte r of input_token is not ALPHA or "*", or
the remaining portion contains a character not in tchar, ":", or the remaining portion contains a character not in tchar, ":", or
"/", fail serialization.</li> "/", fail serialization.</li>
<li>Let output be an empty string.</li> <li pn="section-4.1.7-2.3" derivedCounter="3.">Let output be an empt
<li>Append input_token to output.</li> y string.</li>
<li>Return output.</li> <li pn="section-4.1.7-2.4" derivedCounter="4.">Append input_token to
output.</li>
<li pn="section-4.1.7-2.5" derivedCounter="5.">Return output.</li>
</ol> </ol>
</section> </section>
<section anchor="ser-binary"> <section anchor="ser-binary" numbered="true" removeInRFC="false" toc="in
<name>Serializing a Byte Sequence</name> clude" pn="section-4.1.8">
<t>Given a Byte Sequence as input_bytes, return an ASCII string <name slugifiedName="name-serializing-a-byte-sequence">Serializing a B
yte Sequence</name>
<t indent="0" pn="section-4.1.8-1">Given a Byte Sequence as input_byte
s, return an ASCII string
suitable for use in an HTTP field value.</t> suitable for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If input_bytes is not a sequence of bytes, fail serialization.</ 4.1.8-2">
li> <li pn="section-4.1.8-2.1" derivedCounter="1.">If input_bytes is not
<li>Let output be an empty string.</li> a sequence of bytes, fail serialization.</li>
<li>Append ":" to output.</li> <li pn="section-4.1.8-2.2" derivedCounter="2.">Let output be an empt
<li>Append the result of base64-encoding input_bytes as per <xref ta y string.</li>
rget="RFC4648" sectionFormat="comma" section="4"/>, taking account of <li pn="section-4.1.8-2.3" derivedCounter="3.">Append ":" to output.
</li>
<li pn="section-4.1.8-2.4" derivedCounter="4.">Append the result of
base64-encoding input_bytes as per <xref target="RFC4648" sectionFormat="comma"
section="4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc4648#sec
tion-4" derivedContent="RFC4648"/>, taking account of
the requirements below.</li> the requirements below.</li>
<li>Append ":" to output.</li> <li pn="section-4.1.8-2.5" derivedCounter="5.">Append ":" to output.
<li>Return output.</li> </li>
<li pn="section-4.1.8-2.6" derivedCounter="6.">Return output.</li>
</ol> </ol>
<t>The encoded data is required to be padded with "=", as per <xref ta <t indent="0" pn="section-4.1.8-3">The encoded data is required to be
rget="RFC4648" sectionFormat="comma" section="3.2"/>.</t> padded with "=", as per <xref target="RFC4648" sectionFormat="comma" section="3.
<t>Likewise, encoded data <bcp14>SHOULD</bcp14> have pad bits set to z 2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc4648#section-3.2"
ero, as per derivedContent="RFC4648"/>.</t>
<xref target="RFC4648" sectionFormat="comma" section="3.5"/>, unless it <t indent="0" pn="section-4.1.8-4">Likewise, encoded data <bcp14>SHOUL
is D</bcp14> have pad bits set to zero, as per
<xref target="RFC4648" sectionFormat="comma" section="3.5" format="defa
ult" derivedLink="https://rfc-editor.org/rfc/rfc4648#section-3.5" derivedContent
="RFC4648"/>, unless it is
not possible to do so due to implementation constraints.</t> not possible to do so due to implementation constraints.</t>
</section> </section>
<section anchor="ser-boolean"> <section anchor="ser-boolean" numbered="true" removeInRFC="false" toc="i
<name>Serializing a Boolean</name> nclude" pn="section-4.1.9">
<t>Given a Boolean as input_boolean, return an ASCII string suitable <name slugifiedName="name-serializing-a-boolean">Serializing a Boolean
</name>
<t indent="0" pn="section-4.1.9-1">Given a Boolean as input_boolean, r
eturn an ASCII string suitable
for use in an HTTP field value.</t> for use in an HTTP field value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If input_boolean is not a boolean, fail serialization.</li> 4.1.9-2">
<li>Let output be an empty string.</li> <li pn="section-4.1.9-2.1" derivedCounter="1.">If input_boolean is n
<li>Append "?" to output.</li> ot a boolean, fail serialization.</li>
<li>If input_boolean is true, append "1" to output.</li> <li pn="section-4.1.9-2.2" derivedCounter="2.">Let output be an empt
<li>If input_boolean is false, append "0" to output.</li> y string.</li>
<li>Return output.</li> <li pn="section-4.1.9-2.3" derivedCounter="3.">Append "?" to output.
</li>
<li pn="section-4.1.9-2.4" derivedCounter="4.">If input_boolean is t
rue, append "1" to output.</li>
<li pn="section-4.1.9-2.5" derivedCounter="5.">If input_boolean is f
alse, append "0" to output.</li>
<li pn="section-4.1.9-2.6" derivedCounter="6.">Return output.</li>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="text-parse"> <section anchor="text-parse" numbered="true" removeInRFC="false" toc="incl
<name>Parsing Structured Fields</name> ude" pn="section-4.2">
<t>When a receiving implementation parses HTTP fields that are known <name slugifiedName="name-parsing-structured-fields">Parsing Structured
Fields</name>
<t indent="0" pn="section-4.2-1">When a receiving implementation parses
HTTP fields that are known
to be Structured Fields, it is important that care be taken, as there to be Structured Fields, it is important that care be taken, as there
are a number of edge cases that can cause interoperability or even are a number of edge cases that can cause interoperability or even
security problems. This section specifies the algorithm for doing security problems. This section specifies the algorithm for doing
so.</t> so.</t>
<t>Given an array of bytes as input_bytes that represent the chosen <t indent="0" pn="section-4.2-2">Given an array of bytes as input_bytes that represent the chosen
field's field-value (which is empty if that field is not present) and field's field-value (which is empty if that field is not present) and
field_type (one of "dictionary", "list", or "item"), return the parsed field_type (one of "dictionary", "list", or "item"), return the parsed
header value.</t> header value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-4.
<li>Convert input_bytes into an ASCII string input_string; if 2-3">
<li pn="section-4.2-3.1" derivedCounter="1.">Convert input_bytes into
an ASCII string input_string; if
conversion fails, fail parsing.</li> conversion fails, fail parsing.</li>
<li>Discard any leading SP characters from input_string.</li> <li pn="section-4.2-3.2" derivedCounter="2.">Discard any leading SP ch
<li>If field_type is "list", let output be the result of running aracters from input_string.</li>
Parsing a List (<xref target="parse-list"/>) with <li pn="section-4.2-3.3" derivedCounter="3.">If field_type is "list",
let output be the result of running
Parsing a List (<xref target="parse-list" format="default" sectionForma
t="of" derivedContent="Section 4.2.1"/>) with
input_string.</li> input_string.</li>
<li>If field_type is "dictionary", let output be the result of <li pn="section-4.2-3.4" derivedCounter="4.">If field_type is "diction
running Parsing a Dictionary (<xref target="parse-dictionary"/>) with i ary", let output be the result of
nput_string.</li> running Parsing a Dictionary (<xref target="parse-dictionary" format="d
<li>If field_type is "item", let output be the result of running efault" sectionFormat="of" derivedContent="Section 4.2.2"/>) with input_string.<
Parsing an Item (<xref target="parse-item"/>) with /li>
<li pn="section-4.2-3.5" derivedCounter="5.">If field_type is "item",
let output be the result of running
Parsing an Item (<xref target="parse-item" format="default" sectionForm
at="of" derivedContent="Section 4.2.3"/>) with
input_string.</li> input_string.</li>
<li>Discard any leading SP characters from input_string.</li> <li pn="section-4.2-3.6" derivedCounter="6.">Discard any leading SP ch
<li>If input_string is not empty, fail parsing.</li> aracters from input_string.</li>
<li>Otherwise, return output.</li> <li pn="section-4.2-3.7" derivedCounter="7.">If input_string is not em
pty, fail parsing.</li>
<li pn="section-4.2-3.8" derivedCounter="8.">Otherwise, return output.
</li>
</ol> </ol>
<t>When generating input_bytes, parsers <bcp14>MUST</bcp14> combine all field lines <t indent="0" pn="section-4.2-4">When generating input_bytes, parsers <b cp14>MUST</bcp14> combine all field lines
in the same section (header or trailer) that case-insensitively match in the same section (header or trailer) that case-insensitively match
the field name into one comma-separated field-value, as per <xref target= "RFC7230" sectionFormat="comma" section="3.2.2"/>; this assures that the field name into one comma-separated field-value, as per <xref target= "RFC7230" sectionFormat="comma" section="3.2.2" format="default" derivedLink="ht tps://rfc-editor.org/rfc/rfc7230#section-3.2.2" derivedContent="RFC7230"/>; this assures that
the entire field value is processed correctly.</t> the entire field value is processed correctly.</t>
<t>For Lists and Dictionaries, this has the effect of correctly <t indent="0" pn="section-4.2-5">For Lists and Dictionaries, this has th e effect of correctly
concatenating all of the field's lines, as long as individual members concatenating all of the field's lines, as long as individual members
of the top-level data structure are not split across multiple header of the top-level data structure are not split across multiple header
instances. The parsing algorithms for both types allow tab characters, instances. The parsing algorithms for both types allow tab characters,
since these might be used to combine field lines by some since these might be used to combine field lines by some
implementations.</t> implementations.</t>
<t>Strings split across multiple field lines will have unpredictable <t indent="0" pn="section-4.2-6">Strings split across multiple field lin es will have unpredictable
results, because one or more commas (with optional whitespace) results, because one or more commas (with optional whitespace)
will become part of the string output by the parser. Since will become part of the string output by the parser. Since
concatenation might be done by an upstream intermediary, the results concatenation might be done by an upstream intermediary, the results
are not under the control of the serializer or the parser, even when are not under the control of the serializer or the parser, even when
they are both under the control of the same party.</t> they are both under the control of the same party.</t>
<t>Tokens, Integers, Decimals, and Byte Sequences cannot be split <t indent="0" pn="section-4.2-7">Tokens, Integers, Decimals, and Byte Se quences cannot be split
across multiple field lines because the inserted commas will cause across multiple field lines because the inserted commas will cause
parsing to fail.</t> parsing to fail.</t>
<t>Parsers <bcp14>MAY</bcp14> fail when processing a field value spread across <t indent="0" pn="section-4.2-8">Parsers <bcp14>MAY</bcp14> fail when pr ocessing a field value spread across
multiple field lines, when one of those lines does not parse as that multiple field lines, when one of those lines does not parse as that
field. For example, a parsing handling an Example-String field that's field. For example, a parsing handling an Example-String field that's
defined as an sf-string is allowed to fail when processing this field defined as an sf-string is allowed to fail when processing this field
section:</t> section:</t>
<sourcecode type="http-message"> <sourcecode type="http-message" markers="false" pn="section-4.2-9">
Example-String: "foo Example-String: "foo
Example-String: bar" Example-String: bar"
</sourcecode> </sourcecode>
<t>If parsing fails -- including when calling another algorithm -- the <t indent="0" pn="section-4.2-10">If parsing fails -- including when cal ling another algorithm -- the
entire field value <bcp14>MUST</bcp14> be ignored (i.e., treated as if th e field were entire field value <bcp14>MUST</bcp14> be ignored (i.e., treated as if th e field were
not present in the section). This is intentionally strict, to improve not present in the section). This is intentionally strict, to improve
interoperability and safety, and specifications referencing this interoperability and safety, and specifications referencing this
document are not allowed to loosen this requirement.</t> document are not allowed to loosen this requirement.</t>
<t>Note that this requirement does not apply to an implementation that <t indent="0" pn="section-4.2-11">Note that this requirement does not ap ply to an implementation that
is not parsing the field; for example, an intermediary is not required is not parsing the field; for example, an intermediary is not required
to strip a failing field from a message before forwarding it.</t> to strip a failing field from a message before forwarding it.</t>
<section anchor="parse-list"> <section anchor="parse-list" numbered="true" removeInRFC="false" toc="in
<name>Parsing a List</name> clude" pn="section-4.2.1">
<t>Given an ASCII string as input_string, return an array of <name slugifiedName="name-parsing-a-list">Parsing a List</name>
<t indent="0" pn="section-4.2.1-1">Given an ASCII string as input_stri
ng, return an array of
(item_or_inner_list, parameters) tuples. input_string is modified to (item_or_inner_list, parameters) tuples. input_string is modified to
remove the parsed value.</t> remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let members be an empty array.</li> 4.2.1-2">
<li> <li pn="section-4.2.1-2.1" derivedCounter="1.">Let members be an emp
<t>While input_string is not empty: ty array.</li>
<li pn="section-4.2.1-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.2.1-2.2.1">While input_string is not e
mpty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>Append the result of running Parsing an Item or Inner List ion-4.2.1-2.2.2">
(<xref target="parse-item-or-list"/>) with <li pn="section-4.2.1-2.2.2.1" derivedCounter="1.">Append the re
sult of running Parsing an Item or Inner List
(<xref target="parse-item-or-list" format="default" sectionFormat
="of" derivedContent="Section 4.2.1.1"/>) with
input_string to members.</li> input_string to members.</li>
<li>Discard any leading OWS characters from input_string.</li> <li pn="section-4.2.1-2.2.2.2" derivedCounter="2.">Discard any l
<li>If input_string is empty, return members.</li> eading OWS characters from input_string.</li>
<li>Consume the first character of input_string; if it is not <li pn="section-4.2.1-2.2.2.3" derivedCounter="3.">If input_stri
ng is empty, return members.</li>
<li pn="section-4.2.1-2.2.2.4" derivedCounter="4.">Consume the f
irst character of input_string; if it is not
",", fail parsing.</li> ",", fail parsing.</li>
<li>Discard any leading OWS characters from input_string.</li> <li pn="section-4.2.1-2.2.2.5" derivedCounter="5.">Discard any l
<li>If input_string is empty, there is a trailing comma; fail pa eading OWS characters from input_string.</li>
rsing.</li> <li pn="section-4.2.1-2.2.2.6" derivedCounter="6.">If input_stri
ng is empty, there is a trailing comma; fail parsing.</li>
</ol> </ol>
</li> </li>
<li>No structured data has been found; return members (which is empt y).</li> <li pn="section-4.2.1-2.3" derivedCounter="3.">No structured data ha s been found; return members (which is empty).</li>
</ol> </ol>
<section anchor="parse-item-or-list"> <section anchor="parse-item-or-list" numbered="true" removeInRFC="fals
<name>Parsing an Item or Inner List</name> e" toc="exclude" pn="section-4.2.1.1">
<t>Given an ASCII string as input_string, return the tuple <name slugifiedName="name-parsing-an-item-or-inner-li">Parsing an It
em or Inner List</name>
<t indent="0" pn="section-4.2.1.1-1">Given an ASCII string as input_
string, return the tuple
(item_or_inner_list, parameters), where item_or_inner_list can be (item_or_inner_list, parameters), where item_or_inner_list can be
either a single bare item or an array of (bare_item, parameters) either a single bare item or an array of (bare_item, parameters)
tuples. input_string is modified to remove the parsed value.</t> tuples. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>If the first character of input_string is "(", return the n-4.2.1.1-2">
result of running Parsing an Inner List (<xref target="parse-innerl <li pn="section-4.2.1.1-2.1" derivedCounter="1.">If the first char
ist"/>) with acter of input_string is "(", return the
result of running Parsing an Inner List (<xref target="parse-innerl
ist" format="default" sectionFormat="of" derivedContent="Section 4.2.1.2"/>) wit
h
input_string.</li> input_string.</li>
<li>Return the result of running Parsing an Item (<xref target="pa rse-item"/>) with input_string.</li> <li pn="section-4.2.1.1-2.2" derivedCounter="2.">Return the result of running Parsing an Item (<xref target="parse-item" format="default" sectionF ormat="of" derivedContent="Section 4.2.3"/>) with input_string.</li>
</ol> </ol>
</section> </section>
<section anchor="parse-innerlist"> <section anchor="parse-innerlist" numbered="true" removeInRFC="false"
<name>Parsing an Inner List</name> toc="exclude" pn="section-4.2.1.2">
<t>Given an ASCII string as input_string, return the tuple <name slugifiedName="name-parsing-an-inner-list">Parsing an Inner Li
st</name>
<t indent="0" pn="section-4.2.1.2-1">Given an ASCII string as input_
string, return the tuple
(inner_list, parameters), where inner_list is an array of (inner_list, parameters), where inner_list is an array of
(bare_item, parameters) tuples. input_string is modified to remove (bare_item, parameters) tuples. input_string is modified to remove
the parsed value.</t> the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>Consume the first character of input_string; if it is not n-4.2.1.2-2">
<li pn="section-4.2.1.2-2.1" derivedCounter="1.">Consume the first
character of input_string; if it is not
"(", fail parsing.</li> "(", fail parsing.</li>
<li>Let inner_list be an empty array.</li> <li pn="section-4.2.1.2-2.2" derivedCounter="2.">Let inner_list be
<li> an empty array.</li>
<t>While input_string is not empty: <li pn="section-4.2.1.2-2.3" derivedCounter="3.">
<t indent="0" pn="section-4.2.1.2-2.3.1">While input_string is n
ot empty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="se
<li>Discard any leading SP characters from input_string.</li> ction-4.2.1.2-2.3.2">
<li> <li pn="section-4.2.1.2-2.3.2.1" derivedCounter="1.">Discard a
<t>If the first character of input_string is ")": ny leading SP characters from input_string.</li>
<li pn="section-4.2.1.2-2.3.2.2" derivedCounter="2.">
<t indent="0" pn="section-4.2.1.2-2.3.2.2.1">If the first ch
aracter of input_string is ")":
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn
<li>Consume the first character of input_string.</li> ="section-4.2.1.2-2.3.2.2.2">
<li>Let parameters be the result of running Parsing <li pn="section-4.2.1.2-2.3.2.2.2.1" derivedCounter="1.">C
Parameters (<xref target="parse-param"/>) with input_string onsume the first character of input_string.</li>
.</li> <li pn="section-4.2.1.2-2.3.2.2.2.2" derivedCounter="2.">L
<li>Return the tuple (inner_list, parameters).</li> et parameters be the result of running Parsing
Parameters (<xref target="parse-param" format="default" sec
tionFormat="of" derivedContent="Section 4.2.3.2"/>) with input_string.</li>
<li pn="section-4.2.1.2-2.3.2.2.2.3" derivedCounter="3.">R
eturn the tuple (inner_list, parameters).</li>
</ol> </ol>
</li> </li>
<li>Let item be the result of running Parsing an Item (<xref t arget="parse-item"/>) with <li pn="section-4.2.1.2-2.3.2.3" derivedCounter="3.">Let item be the result of running Parsing an Item (<xref target="parse-item" format="defa ult" sectionFormat="of" derivedContent="Section 4.2.3"/>) with
input_string.</li> input_string.</li>
<li>Append item to inner_list.</li> <li pn="section-4.2.1.2-2.3.2.4" derivedCounter="4.">Append it
<li>If the first character of input_string is not SP or ")", em to inner_list.</li>
<li pn="section-4.2.1.2-2.3.2.5" derivedCounter="5.">If the fi
rst character of input_string is not SP or ")",
fail parsing.</li> fail parsing.</li>
</ol> </ol>
</li> </li>
<li>The end of the Inner List was not found; fail parsing.</li> <li pn="section-4.2.1.2-2.4" derivedCounter="4.">The end of the In ner List was not found; fail parsing.</li>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="parse-dictionary"> <section anchor="parse-dictionary" numbered="true" removeInRFC="false" t
<name>Parsing a Dictionary</name> oc="include" pn="section-4.2.2">
<t>Given an ASCII string as input_string, return an ordered map <name slugifiedName="name-parsing-a-dictionary">Parsing a Dictionary</
name>
<t indent="0" pn="section-4.2.2-1">Given an ASCII string as input_stri
ng, return an ordered map
whose values are (item_or_inner_list, parameters) whose values are (item_or_inner_list, parameters)
tuples. input_string is modified to remove the parsed value.</t> tuples. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let dictionary be an empty, ordered map.</li> 4.2.2-2">
<li> <li pn="section-4.2.2-2.1" derivedCounter="1.">Let dictionary be an
<t>While input_string is not empty: empty, ordered map.</li>
<li pn="section-4.2.2-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.2.2-2.2.1">While input_string is not e
mpty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>Let this_key be the result of running Parsing a Key (<xref t ion-4.2.2-2.2.2">
arget="parse-key"/>) with input_string.</li> <li pn="section-4.2.2-2.2.2.1" derivedCounter="1.">Let this_key
<li> be the result of running Parsing a Key (<xref target="parse-key" format="default
<t>If the first character of input_string is "=": " sectionFormat="of" derivedContent="Section 4.2.3.3"/>) with input_string.</li>
<li pn="section-4.2.2-2.2.2.2" derivedCounter="2.">
<t indent="0" pn="section-4.2.2-2.2.2.2.1">If the first charac
ter of input_string is "=":
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Consume the first character of input_string.</li> section-4.2.2-2.2.2.2.2">
<li>Let member be the result of running Parsing an Item or <li pn="section-4.2.2-2.2.2.2.2.1" derivedCounter="1.">Consu
Inner List (<xref target="parse-item-or-list"/>) with input_s me the first character of input_string.</li>
tring.</li> <li pn="section-4.2.2-2.2.2.2.2.2" derivedCounter="2.">Let m
ember be the result of running Parsing an Item or
Inner List (<xref target="parse-item-or-list" format="default
" sectionFormat="of" derivedContent="Section 4.2.1.1"/>) with input_string.</li>
</ol> </ol>
</li> </li>
<li> <li pn="section-4.2.2-2.2.2.3" derivedCounter="3.">
<t>Otherwise: <t indent="0" pn="section-4.2.2-2.2.2.3.1">Otherwise:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>Let value be Boolean true.</li> section-4.2.2-2.2.2.3.2">
<li>Let parameters be the result of running Parsing <li pn="section-4.2.2-2.2.2.3.2.1" derivedCounter="1.">Let v
Parameters (<xref target="parse-param"/>) alue be Boolean true.</li>
<li pn="section-4.2.2-2.2.2.3.2.2" derivedCounter="2.">Let p
arameters be the result of running Parsing
Parameters (<xref target="parse-param" format="default" secti
onFormat="of" derivedContent="Section 4.2.3.2"/>)
with input_string.</li> with input_string.</li>
<li>Let member be the tuple (value, parameters).</li> <li pn="section-4.2.2-2.2.2.3.2.3" derivedCounter="3.">Let m ember be the tuple (value, parameters).</li>
</ol> </ol>
</li> </li>
<li>Add name this_key with value member to dictionary. If <li pn="section-4.2.2-2.2.2.4" derivedCounter="4.">Add name this _key with value member to dictionary. If
dictionary already contains a name this_key (comparing dictionary already contains a name this_key (comparing
character for character), overwrite its value.</li> character for character), overwrite its value.</li>
<li>Discard any leading OWS characters from input_string.</li> <li pn="section-4.2.2-2.2.2.5" derivedCounter="5.">Discard any l
<li>If input_string is empty, return dictionary.</li> eading OWS characters from input_string.</li>
<li>Consume the first character of input_string; if it is not <li pn="section-4.2.2-2.2.2.6" derivedCounter="6.">If input_stri
ng is empty, return dictionary.</li>
<li pn="section-4.2.2-2.2.2.7" derivedCounter="7.">Consume the f
irst character of input_string; if it is not
",", fail parsing.</li> ",", fail parsing.</li>
<li>Discard any leading OWS characters from input_string.</li> <li pn="section-4.2.2-2.2.2.8" derivedCounter="8.">Discard any l
<li>If input_string is empty, there is a trailing comma; fail pa eading OWS characters from input_string.</li>
rsing.</li> <li pn="section-4.2.2-2.2.2.9" derivedCounter="9.">If input_stri
ng is empty, there is a trailing comma; fail parsing.</li>
</ol> </ol>
</li> </li>
<li>No structured data has been found; return dictionary (which is e mpty).</li> <li pn="section-4.2.2-2.3" derivedCounter="3.">No structured data ha s been found; return dictionary (which is empty).</li>
</ol> </ol>
<t>Note that when duplicate Dictionary keys are encountered, all but <t indent="0" pn="section-4.2.2-3">Note that when duplicate Dictionary keys are encountered, all but
the last instance are ignored.</t> the last instance are ignored.</t>
</section> </section>
<section anchor="parse-item"> <section anchor="parse-item" numbered="true" removeInRFC="false" toc="in
<name>Parsing an Item</name> clude" pn="section-4.2.3">
<t>Given an ASCII string as input_string, return a (bare_item, <name slugifiedName="name-parsing-an-item">Parsing an Item</name>
<t indent="0" pn="section-4.2.3-1">Given an ASCII string as input_stri
ng, return a (bare_item,
parameters) tuple. input_string is modified to remove the parsed parameters) tuple. input_string is modified to remove the parsed
value.</t> value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let bare_item be the result of running Parsing a Bare Item 4.2.3-2">
(<xref target="parse-bare-item"/>) with <li pn="section-4.2.3-2.1" derivedCounter="1.">Let bare_item be the
result of running Parsing a Bare Item
(<xref target="parse-bare-item" format="default" sectionFormat="of" d
erivedContent="Section 4.2.3.1"/>) with
input_string.</li> input_string.</li>
<li>Let parameters be the result of running Parsing Parameters <li pn="section-4.2.3-2.2" derivedCounter="2.">Let parameters be the
(<xref target="parse-param"/>) with result of running Parsing Parameters
(<xref target="parse-param" format="default" sectionFormat="of" deriv
edContent="Section 4.2.3.2"/>) with
input_string.</li> input_string.</li>
<li>Return the tuple (bare_item, parameters).</li> <li pn="section-4.2.3-2.3" derivedCounter="3.">Return the tuple (bar e_item, parameters).</li>
</ol> </ol>
<section anchor="parse-bare-item"> <section anchor="parse-bare-item" numbered="true" removeInRFC="false"
<name>Parsing a Bare Item</name> toc="exclude" pn="section-4.2.3.1">
<t>Given an ASCII string as input_string, return a bare <name slugifiedName="name-parsing-a-bare-item">Parsing a Bare Item</
name>
<t indent="0" pn="section-4.2.3.1-1">Given an ASCII string as input_
string, return a bare
Item. input_string is modified to remove the parsed value.</t> Item. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>If the first character of input_string is a "-" or a DIGIT, n-4.2.3.1-2">
<li pn="section-4.2.3.1-2.1" derivedCounter="1.">If the first char
acter of input_string is a "-" or a DIGIT,
return the result of running Parsing an Integer or Decimal return the result of running Parsing an Integer or Decimal
(<xref target="parse-number"/>) with (<xref target="parse-number" format="default" sectionFormat="of" de rivedContent="Section 4.2.4"/>) with
input_string.</li> input_string.</li>
<li>If the first character of input_string is a DQUOTE, return <li pn="section-4.2.3.1-2.2" derivedCounter="2.">If the first char
the result of running Parsing a String (<xref target="parse-string" acter of input_string is a DQUOTE, return
/>) with the result of running Parsing a String (<xref target="parse-string"
format="default" sectionFormat="of" derivedContent="Section 4.2.5"/>) with
input_string.</li> input_string.</li>
<li>If the first character of input_string is an ALPHA or "*", <li pn="section-4.2.3.1-2.3" derivedCounter="3.">If the first char
return the result of running Parsing a Token (<xref target="parse-t acter of input_string is an ALPHA or "*",
oken"/>) with input_string.</li> return the result of running Parsing a Token (<xref target="parse-t
<li>If the first character of input_string is ":", return the oken" format="default" sectionFormat="of" derivedContent="Section 4.2.6"/>) with
result of running Parsing a Byte Sequence (<xref target="parse-bina input_string.</li>
ry"/>) with <li pn="section-4.2.3.1-2.4" derivedCounter="4.">If the first char
acter of input_string is ":", return the
result of running Parsing a Byte Sequence (<xref target="parse-bina
ry" format="default" sectionFormat="of" derivedContent="Section 4.2.7"/>) with
input_string.</li> input_string.</li>
<li>If the first character of input_string is "?", return the <li pn="section-4.2.3.1-2.5" derivedCounter="5.">If the first char
result of running Parsing a Boolean (<xref target="parse-boolean"/> acter of input_string is "?", return the
) with result of running Parsing a Boolean (<xref target="parse-boolean" f
ormat="default" sectionFormat="of" derivedContent="Section 4.2.8"/>) with
input_string.</li> input_string.</li>
<li>Otherwise, the item type is unrecognized; fail parsing.</li> <li pn="section-4.2.3.1-2.6" derivedCounter="6.">Otherwise, the it em type is unrecognized; fail parsing.</li>
</ol> </ol>
</section> </section>
<section anchor="parse-param"> <section anchor="parse-param" numbered="true" removeInRFC="false" toc=
<name>Parsing Parameters</name> "exclude" pn="section-4.2.3.2">
<t>Given an ASCII string as input_string, return an ordered map <name slugifiedName="name-parsing-parameters">Parsing Parameters</na
me>
<t indent="0" pn="section-4.2.3.2-1">Given an ASCII string as input_
string, return an ordered map
whose values are bare Items. input_string is modified to remove whose values are bare Items. input_string is modified to remove
the parsed value.</t> the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>Let parameters be an empty, ordered map.</li> n-4.2.3.2-2">
<li> <li pn="section-4.2.3.2-2.1" derivedCounter="1.">Let parameters be
<t>While input_string is not empty: an empty, ordered map.</li>
<li pn="section-4.2.3.2-2.2" derivedCounter="2.">
<t indent="0" pn="section-4.2.3.2-2.2.1">While input_string is n
ot empty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="se
<li>If the first character of input_string is not ";", exit th ction-4.2.3.2-2.2.2">
e loop.</li> <li pn="section-4.2.3.2-2.2.2.1" derivedCounter="1.">If the fi
<li>Consume a ";" character from the beginning of input_string rst character of input_string is not ";", exit the loop.</li>
.</li> <li pn="section-4.2.3.2-2.2.2.2" derivedCounter="2.">Consume a
<li>Discard any leading SP characters from input_string.</li> ";" character from the beginning of input_string.</li>
<li>Let param_name be the result of running Parsing a Key <li pn="section-4.2.3.2-2.2.2.3" derivedCounter="3.">Discard a
(<xref target="parse-key"/>) with ny leading SP characters from input_string.</li>
<li pn="section-4.2.3.2-2.2.2.4" derivedCounter="4.">Let param
_name be the result of running Parsing a Key
(<xref target="parse-key" format="default" sectionFormat="of" d
erivedContent="Section 4.2.3.3"/>) with
input_string.</li> input_string.</li>
<li>Let param_value be Boolean true.</li> <li pn="section-4.2.3.2-2.2.2.5" derivedCounter="5.">Let param
<li> _value be Boolean true.</li>
<t>If the first character of input_string is "=": <li pn="section-4.2.3.2-2.2.2.6" derivedCounter="6.">
<t indent="0" pn="section-4.2.3.2-2.2.2.6.1">If the first ch
aracter of input_string is "=":
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn
<li>Consume the "=" character at the beginning of input_st ="section-4.2.3.2-2.2.2.6.2">
ring.</li> <li pn="section-4.2.3.2-2.2.2.6.2.1" derivedCounter="1.">C
<li>Let param_value be the result of running Parsing a onsume the "=" character at the beginning of input_string.</li>
Bare Item (<xref target="parse-bare-item"/>) with input_str <li pn="section-4.2.3.2-2.2.2.6.2.2" derivedCounter="2.">L
ing.</li> et param_value be the result of running Parsing a
Bare Item (<xref target="parse-bare-item" format="default"
sectionFormat="of" derivedContent="Section 4.2.3.1"/>) with input_string.</li>
</ol> </ol>
</li> </li>
<li>Append key param_name with value param_value to <li pn="section-4.2.3.2-2.2.2.7" derivedCounter="7.">Append ke y param_name with value param_value to
parameters. If parameters already contains a name param_name parameters. If parameters already contains a name param_name
(comparing character for character), overwrite its (comparing character for character), overwrite its
value.</li> value.</li>
</ol> </ol>
</li> </li>
<li>Return parameters.</li> <li pn="section-4.2.3.2-2.3" derivedCounter="3.">Return parameters .</li>
</ol> </ol>
<t>Note that when duplicate parameter keys are encountered, <t indent="0" pn="section-4.2.3.2-3">Note that when duplicate parame ter keys are encountered,
all but the last instance are ignored.</t> all but the last instance are ignored.</t>
</section> </section>
<section anchor="parse-key"> <section anchor="parse-key" numbered="true" removeInRFC="false" toc="e
<name>Parsing a Key</name> xclude" pn="section-4.2.3.3">
<t>Given an ASCII string as input_string, return a <name slugifiedName="name-parsing-a-key">Parsing a Key</name>
<t indent="0" pn="section-4.2.3.3-1">Given an ASCII string as input_
string, return a
key. input_string is modified to remove the parsed value.</t> key. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sectio
<li>If the first character of input_string is not lcalpha or n-4.2.3.3-2">
<li pn="section-4.2.3.3-2.1" derivedCounter="1.">If the first char
acter of input_string is not lcalpha or
"*", fail parsing.</li> "*", fail parsing.</li>
<li>Let output_string be an empty string.</li> <li pn="section-4.2.3.3-2.2" derivedCounter="2.">Let output_string
<li> be an empty string.</li>
<t>While input_string is not empty: <li pn="section-4.2.3.3-2.3" derivedCounter="3.">
<t indent="0" pn="section-4.2.3.3-2.3.1">While input_string is n
ot empty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="se
<li>If the first character of input_string is not one of ction-4.2.3.3-2.3.2">
<li pn="section-4.2.3.3-2.3.2.1" derivedCounter="1.">If the fi
rst character of input_string is not one of
lcalpha, DIGIT, "_", "-", ".", or "*", return lcalpha, DIGIT, "_", "-", ".", or "*", return
output_string.</li> output_string.</li>
<li>Let char be the result of consuming the first character of <li pn="section-4.2.3.3-2.3.2.2" derivedCounter="2.">Let char
input_string.</li> be the result of consuming the first character of input_string.</li>
<li>Append char to output_string.</li> <li pn="section-4.2.3.3-2.3.2.3" derivedCounter="3.">Append ch
ar to output_string.</li>
</ol> </ol>
</li> </li>
<li>Return output_string.</li> <li pn="section-4.2.3.3-2.4" derivedCounter="4.">Return output_str ing.</li>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="parse-number"> <section anchor="parse-number" numbered="true" removeInRFC="false" toc="
<name>Parsing an Integer or Decimal</name> include" pn="section-4.2.4">
<t>Given an ASCII string as input_string, return an Integer or <name slugifiedName="name-parsing-an-integer-or-decim">Parsing an Inte
ger or Decimal</name>
<t indent="0" pn="section-4.2.4-1">Given an ASCII string as input_stri
ng, return an Integer or
Decimal. input_string is modified to remove the parsed value.</t> Decimal. input_string is modified to remove the parsed value.</t>
<t>NOTE: This algorithm parses both Integers (<xref target="integer"/> <t indent="0" pn="section-4.2.4-2">NOTE: This algorithm parses both In
) and Decimals (<xref target="decimal"/>), and returns the corresponding structu tegers (<xref target="integer" format="default" sectionFormat="of" derivedConten
re.</t> t="Section 3.3.1"/>) and Decimals (<xref target="decimal" format="default" secti
<ol> onFormat="of" derivedContent="Section 3.3.2"/>), and returns the corresponding s
<li>Let type be "integer".</li> tructure.</t>
<li>Let sign be 1.</li> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let input_number be an empty string.</li> 4.2.4-3">
<li>If the first character of input_string is "-", consume it and <li pn="section-4.2.4-3.1" derivedCounter="1.">Let type be "integer"
.</li>
<li pn="section-4.2.4-3.2" derivedCounter="2.">Let sign be 1.</li>
<li pn="section-4.2.4-3.3" derivedCounter="3.">Let input_number be a
n empty string.</li>
<li pn="section-4.2.4-3.4" derivedCounter="4.">If the first characte
r of input_string is "-", consume it and
set sign to -1.</li> set sign to -1.</li>
<li>If input_string is empty, there is an empty integer; fail <li pn="section-4.2.4-3.5" derivedCounter="5.">If input_string is em pty, there is an empty integer; fail
parsing.</li> parsing.</li>
<li>If the first character of input_string is not a DIGIT, fail <li pn="section-4.2.4-3.6" derivedCounter="6.">If the first characte r of input_string is not a DIGIT, fail
parsing.</li> parsing.</li>
<li> <li pn="section-4.2.4-3.7" derivedCounter="7.">
<t>While input_string is not empty: <t indent="0" pn="section-4.2.4-3.7.1">While input_string is not e
mpty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>Let char be the result of consuming the first character of ion-4.2.4-3.7.2">
<li pn="section-4.2.4-3.7.2.1" derivedCounter="1.">Let char be t
he result of consuming the first character of
input_string.</li> input_string.</li>
<li>If char is a DIGIT, append it to input_number.</li> <li pn="section-4.2.4-3.7.2.2" derivedCounter="2.">If char is a
<li> DIGIT, append it to input_number.</li>
<t>Else, if type is "integer" and char is ".": <li pn="section-4.2.4-3.7.2.3" derivedCounter="3.">
<t indent="0" pn="section-4.2.4-3.7.2.3.1">Else, if type is "i
nteger" and char is ".":
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>If input_number contains more than 12 characters, fail p section-4.2.4-3.7.2.3.2">
arsing.</li> <li pn="section-4.2.4-3.7.2.3.2.1" derivedCounter="1.">If in
<li>Otherwise, append char to input_number and set type to " put_number contains more than 12 characters, fail parsing.</li>
decimal".</li> <li pn="section-4.2.4-3.7.2.3.2.2" derivedCounter="2.">Other
wise, append char to input_number and set type to "decimal".</li>
</ol> </ol>
</li> </li>
<li>Otherwise, prepend char to input_string, and exit the loop.< <li pn="section-4.2.4-3.7.2.4" derivedCounter="4.">Otherwise, pr
/li> epend char to input_string, and exit the loop.</li>
<li>If type is "integer" and input_number contains more than <li pn="section-4.2.4-3.7.2.5" derivedCounter="5.">If type is "i
nteger" and input_number contains more than
15 characters, fail parsing.</li> 15 characters, fail parsing.</li>
<li>If type is "decimal" and input_number contains more than <li pn="section-4.2.4-3.7.2.6" derivedCounter="6.">If type is "d ecimal" and input_number contains more than
16 characters, fail parsing.</li> 16 characters, fail parsing.</li>
</ol> </ol>
</li> </li>
<li> <li pn="section-4.2.4-3.8" derivedCounter="8.">
<t>If type is "integer": <t indent="0" pn="section-4.2.4-3.8.1">If type is "integer":
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>Parse input_number as an integer and let output_number be ion-4.2.4-3.8.2">
<li pn="section-4.2.4-3.8.2.1" derivedCounter="1.">Parse input_n
umber as an integer and let output_number be
the product of the result and sign.</li> the product of the result and sign.</li>
<li>If output_number is outside the range -999,999,999,999,999 <li pn="section-4.2.4-3.8.2.2" derivedCounter="2.">If output_num ber is outside the range -999,999,999,999,999
to 999,999,999,999,999 inclusive, fail parsing.</li> to 999,999,999,999,999 inclusive, fail parsing.</li>
</ol> </ol>
</li> </li>
<li> <li pn="section-4.2.4-3.9" derivedCounter="9.">
<t>Otherwise: <t indent="0" pn="section-4.2.4-3.9.1">Otherwise:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>If the final character of input_number is ".", fail parsing. ion-4.2.4-3.9.2">
</li> <li pn="section-4.2.4-3.9.2.1" derivedCounter="1.">If the final
<li>If the number of characters after "." in input_number is character of input_number is ".", fail parsing.</li>
<li pn="section-4.2.4-3.9.2.2" derivedCounter="2.">If the number
of characters after "." in input_number is
greater than three, fail parsing.</li> greater than three, fail parsing.</li>
<li>Parse input_number as a decimal number and let <li pn="section-4.2.4-3.9.2.3" derivedCounter="3.">Parse input_n umber as a decimal number and let
output_number be the product of the result and sign.</li> output_number be the product of the result and sign.</li>
</ol> </ol>
</li> </li>
<li>Return output_number.</li> <li pn="section-4.2.4-3.10" derivedCounter="10.">Return output_numbe r.</li>
</ol> </ol>
</section> </section>
<section anchor="parse-string"> <section anchor="parse-string" numbered="true" removeInRFC="false" toc="
<name>Parsing a String</name> include" pn="section-4.2.5">
<t>Given an ASCII string as input_string, return an unquoted <name slugifiedName="name-parsing-a-string">Parsing a String</name>
<t indent="0" pn="section-4.2.5-1">Given an ASCII string as input_stri
ng, return an unquoted
String. input_string is modified to remove the parsed value.</t> String. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>Let output_string be an empty string.</li> 4.2.5-2">
<li>If the first character of input_string is not DQUOTE, fail parsi <li pn="section-4.2.5-2.1" derivedCounter="1.">Let output_string be
ng.</li> an empty string.</li>
<li>Discard the first character of input_string.</li> <li pn="section-4.2.5-2.2" derivedCounter="2.">If the first characte
<li> r of input_string is not DQUOTE, fail parsing.</li>
<t>While input_string is not empty: <li pn="section-4.2.5-2.3" derivedCounter="3.">Discard the first cha
racter of input_string.</li>
<li pn="section-4.2.5-2.4" derivedCounter="4.">
<t indent="0" pn="section-4.2.5-2.4.1">While input_string is not e
mpty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>Let char be the result of consuming the first character of i ion-4.2.5-2.4.2">
nput_string.</li> <li pn="section-4.2.5-2.4.2.1" derivedCounter="1.">Let char be t
<li> he result of consuming the first character of input_string.</li>
<t>If char is a backslash ("\"): <li pn="section-4.2.5-2.4.2.2" derivedCounter="2.">
<t indent="0" pn="section-4.2.5-2.4.2.2.1">If char is a backsl
ash ("\"):
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="
<li>If input_string is now empty, fail parsing.</li> section-4.2.5-2.4.2.2.2">
<li>Let next_char be the result of consuming the first <li pn="section-4.2.5-2.4.2.2.2.1" derivedCounter="1.">If in
put_string is now empty, fail parsing.</li>
<li pn="section-4.2.5-2.4.2.2.2.2" derivedCounter="2.">Let n
ext_char be the result of consuming the first
character of input_string.</li> character of input_string.</li>
<li>If next_char is not DQUOTE or "\", fail parsing.</li> <li pn="section-4.2.5-2.4.2.2.2.3" derivedCounter="3.">If ne
<li>Append next_char to output_string.</li> xt_char is not DQUOTE or "\", fail parsing.</li>
<li pn="section-4.2.5-2.4.2.2.2.4" derivedCounter="4.">Appen
d next_char to output_string.</li>
</ol> </ol>
</li> </li>
<li>Else, if char is DQUOTE, return output_string.</li> <li pn="section-4.2.5-2.4.2.3" derivedCounter="3.">Else, if char
<li>Else, if char is in the range %x00-1f or %x7f (i.e., it is is DQUOTE, return output_string.</li>
<li pn="section-4.2.5-2.4.2.4" derivedCounter="4.">Else, if char
is in the range %x00-1f or %x7f (i.e., it is
not in VCHAR or SP), fail parsing.</li> not in VCHAR or SP), fail parsing.</li>
<li>Else, append char to output_string.</li> <li pn="section-4.2.5-2.4.2.5" derivedCounter="5.">Else, append char to output_string.</li>
</ol> </ol>
</li> </li>
<li>Reached the end of input_string without finding a closing <li pn="section-4.2.5-2.5" derivedCounter="5.">Reached the end of in put_string without finding a closing
DQUOTE; fail parsing.</li> DQUOTE; fail parsing.</li>
</ol> </ol>
</section> </section>
<section anchor="parse-token"> <section anchor="parse-token" numbered="true" removeInRFC="false" toc="i
<name>Parsing a Token</name> nclude" pn="section-4.2.6">
<t>Given an ASCII string as input_string, return a <name slugifiedName="name-parsing-a-token">Parsing a Token</name>
<t indent="0" pn="section-4.2.6-1">Given an ASCII string as input_stri
ng, return a
Token. input_string is modified to remove the parsed value.</t> Token. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If the first character of input_string is not ALPHA or "*", 4.2.6-2">
<li pn="section-4.2.6-2.1" derivedCounter="1.">If the first characte
r of input_string is not ALPHA or "*",
fail parsing.</li> fail parsing.</li>
<li>Let output_string be an empty string.</li> <li pn="section-4.2.6-2.2" derivedCounter="2.">Let output_string be
<li> an empty string.</li>
<t>While input_string is not empty: <li pn="section-4.2.6-2.3" derivedCounter="3.">
<t indent="0" pn="section-4.2.6-2.3.1">While input_string is not e
mpty:
</t> </t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="sect
<li>If the first character of input_string is not in tchar, ion-4.2.6-2.3.2">
<li pn="section-4.2.6-2.3.2.1" derivedCounter="1.">If the first
character of input_string is not in tchar,
":", or "/", return output_string.</li> ":", or "/", return output_string.</li>
<li>Let char be the result of consuming the first character of <li pn="section-4.2.6-2.3.2.2" derivedCounter="2.">Let char be t he result of consuming the first character of
input_string.</li> input_string.</li>
<li>Append char to output_string.</li> <li pn="section-4.2.6-2.3.2.3" derivedCounter="3.">Append char t o output_string.</li>
</ol> </ol>
</li> </li>
<li>Return output_string.</li> <li pn="section-4.2.6-2.4" derivedCounter="4.">Return output_string. </li>
</ol> </ol>
</section> </section>
<section anchor="parse-binary"> <section anchor="parse-binary" numbered="true" removeInRFC="false" toc="
<name>Parsing a Byte Sequence</name> include" pn="section-4.2.7">
<t>Given an ASCII string as input_string, return a Byte <name slugifiedName="name-parsing-a-byte-sequence">Parsing a Byte Sequ
ence</name>
<t indent="0" pn="section-4.2.7-1">Given an ASCII string as input_stri
ng, return a Byte
Sequence. input_string is modified to remove the parsed value.</t> Sequence. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If the first character of input_string is not ":", fail parsing. 4.2.7-2">
</li> <li pn="section-4.2.7-2.1" derivedCounter="1.">If the first characte
<li>Discard the first character of input_string.</li> r of input_string is not ":", fail parsing.</li>
<li>If there is not a ":" character before the end of input_string, <li pn="section-4.2.7-2.2" derivedCounter="2.">Discard the first cha
fail parsing.</li> racter of input_string.</li>
<li>Let b64_content be the result of consuming content of <li pn="section-4.2.7-2.3" derivedCounter="3.">If there is not a ":"
character before the end of input_string, fail parsing.</li>
<li pn="section-4.2.7-2.4" derivedCounter="4.">Let b64_content be th
e result of consuming content of
input_string up to but not including the first instance of the input_string up to but not including the first instance of the
character ":".</li> character ":".</li>
<li>Consume the ":" character at the beginning of input_string.</li> <li pn="section-4.2.7-2.5" derivedCounter="5.">Consume the ":" chara
<li>If b64_content contains a character not included in ALPHA, cter at the beginning of input_string.</li>
<li pn="section-4.2.7-2.6" derivedCounter="6.">If b64_content contai
ns a character not included in ALPHA,
DIGIT, "+", "/", and "=", fail parsing.</li> DIGIT, "+", "/", and "=", fail parsing.</li>
<li>Let binary_content be the result of base64-decoding <xref target ="RFC4648"/> b64_content, synthesizing <li pn="section-4.2.7-2.7" derivedCounter="7.">Let binary_content be the result of base64-decoding <xref target="RFC4648" format="default" sectionFo rmat="of" derivedContent="RFC4648"/> b64_content, synthesizing
padding if necessary (note the requirements about recipient padding if necessary (note the requirements about recipient
behavior below).</li> behavior below).</li>
<li>Return binary_content.</li> <li pn="section-4.2.7-2.8" derivedCounter="8.">Return binary_content .</li>
</ol> </ol>
<t>Because some implementations of base64 do not allow rejection of <t indent="0" pn="section-4.2.7-3">Because some implementations of bas
encoded data that is not properly "=" padded (see <xref target="RFC4648 e64 do not allow rejection of
" sectionFormat="comma" section="3.2"/>), parsers <bcp14>SHOULD encoded data that is not properly "=" padded (see <xref target="RFC4648
NOT</bcp14> fail when "=" padding is not present, unless they cannot be " sectionFormat="comma" section="3.2" format="default" derivedLink="https://rfc-
editor.org/rfc/rfc4648#section-3.2" derivedContent="RFC4648"/>), parsers <bcp14>
SHOULD NOT</bcp14> fail when "=" padding is not present, unless they cannot be
configured to do so.</t> configured to do so.</t>
<t>Because some implementations of base64 do not allow rejection of <t indent="0" pn="section-4.2.7-4">Because some implementations of bas
encoded data that has non-zero pad bits (see <xref target="RFC4648" sec e64 do not allow rejection of
tionFormat="comma" section="3.5"/>), parsers <bcp14>SHOULD NOT</bcp14> fail when encoded data that has non-zero pad bits (see <xref target="RFC4648" sec
tionFormat="comma" section="3.5" format="default" derivedLink="https://rfc-edito
r.org/rfc/rfc4648#section-3.5" derivedContent="RFC4648"/>), parsers <bcp14>SHOUL
D NOT</bcp14> fail when
non-zero pad bits are present, unless they cannot be configured to non-zero pad bits are present, unless they cannot be configured to
do so.</t> do so.</t>
<t>This specification does not relax the requirements in <xref target= "RFC4648"/>, Sections <xref target="RFC4648" sectionFormat="bare" section="3.1"/ > and <xref target="RFC4648" sectionFormat="bare" section="3.3"/>; therefore, <t indent="0" pn="section-4.2.7-5">This specification does not relax t he requirements in <xref target="RFC4648" format="default" sectionFormat="of" de rivedContent="RFC4648"/>, Sections <xref target="RFC4648" sectionFormat="bare" s ection="3.1" format="default" derivedLink="https://rfc-editor.org/rfc/rfc4648#se ction-3.1" derivedContent="RFC4648"/> and <xref target="RFC4648" sectionFormat=" bare" section="3.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc 4648#section-3.3" derivedContent="RFC4648"/>; therefore,
parsers <bcp14>MUST</bcp14> fail on characters outside the base64 alpha bet and on line parsers <bcp14>MUST</bcp14> fail on characters outside the base64 alpha bet and on line
feeds in encoded data.</t> feeds in encoded data.</t>
</section> </section>
<section anchor="parse-boolean"> <section anchor="parse-boolean" numbered="true" removeInRFC="false" toc=
<name>Parsing a Boolean</name> "include" pn="section-4.2.8">
<t>Given an ASCII string as input_string, return a <name slugifiedName="name-parsing-a-boolean">Parsing a Boolean</name>
<t indent="0" pn="section-4.2.8-1">Given an ASCII string as input_stri
ng, return a
Boolean. input_string is modified to remove the parsed value.</t> Boolean. input_string is modified to remove the parsed value.</t>
<ol> <ol indent="adaptive" spacing="normal" start="1" type="1" pn="section-
<li>If the first character of input_string is not "?", fail parsing. 4.2.8-2">
</li> <li pn="section-4.2.8-2.1" derivedCounter="1.">If the first characte
<li>Discard the first character of input_string.</li> r of input_string is not "?", fail parsing.</li>
<li>If the first character of input_string matches "1", discard <li pn="section-4.2.8-2.2" derivedCounter="2.">Discard the first cha
racter of input_string.</li>
<li pn="section-4.2.8-2.3" derivedCounter="3.">If the first characte
r of input_string matches "1", discard
the first character, and return true.</li> the first character, and return true.</li>
<li>If the first character of input_string matches "0", discard <li pn="section-4.2.8-2.4" derivedCounter="4.">If the first characte r of input_string matches "0", discard
the first character, and return false.</li> the first character, and return false.</li>
<li>No value has matched; fail parsing.</li> <li pn="section-4.2.8-2.5" derivedCounter="5.">No value has matched; fail parsing.</li>
</ol> </ol>
</section> </section>
</section> </section>
</section> </section>
<section anchor="iana-considerations"> <section anchor="iana-considerations" numbered="true" removeInRFC="false" to
<name>IANA Considerations</name> c="include" pn="section-5">
<t>This document has no IANA actions.</t> <name slugifiedName="name-iana-considerations">IANA Considerations</name>
<t indent="0" pn="section-5-1">This document has no IANA actions.</t>
</section> </section>
<section anchor="security-considerations"> <section anchor="security-considerations" numbered="true" removeInRFC="false
<name>Security Considerations</name> " toc="include" pn="section-6">
<t>The size of most types defined by Structured Fields is not limited; <name slugifiedName="name-security-considerations">Security Considerations
</name>
<t indent="0" pn="section-6-1">The size of most types defined by Structure
d Fields is not limited;
as a result, extremely large fields could be an attack vector (e.g., for as a result, extremely large fields could be an attack vector (e.g., for
resource consumption). Most HTTP implementations limit the sizes of resource consumption). Most HTTP implementations limit the sizes of
individual fields as well as the overall header or trailer section size individual fields as well as the overall header or trailer section size
to mitigate such attacks.</t> to mitigate such attacks.</t>
<t>It is possible for parties with the ability to inject new HTTP fields <t indent="0" pn="section-6-2">It is possible for parties with the ability to inject new HTTP fields
to change the meaning of a Structured Field. In some circumstances, this to change the meaning of a Structured Field. In some circumstances, this
will cause parsing to fail, but it is not possible to reliably fail in will cause parsing to fail, but it is not possible to reliably fail in
all such circumstances.</t> all such circumstances.</t>
</section> </section>
</middle> </middle>
<back> <back>
<references> <references pn="section-7">
<name>References</name> <name slugifiedName="name-references">References</name>
<references> <references pn="section-7.1">
<name>Normative References</name> <name slugifiedName="name-normative-references">Normative References</na
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer me>
ence.RFC.7230.xml"/> <reference anchor="RFC0020" target="https://www.rfc-editor.org/info/rfc2
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer 0" quoteTitle="true" derivedAnchor="RFC0020">
ence.RFC.2119.xml"/> <front>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer <title>ASCII format for network interchange</title>
ence.RFC.8174.xml"/> <author initials="V.G." surname="Cerf" fullname="V.G. Cerf">
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer <organization showOnFrontPage="true"/>
ence.RFC.5234.xml"/> </author>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer <date year="1969" month="October"/>
ence.RFC.0020.xml"/> </front>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer <seriesInfo name="STD" value="80"/>
ence.RFC.4648.xml"/> <seriesInfo name="RFC" value="20"/>
<seriesInfo name="DOI" value="10.17487/RFC0020"/>
</reference>
<reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2
119" quoteTitle="true" derivedAnchor="RFC2119">
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</tit
le>
<author initials="S." surname="Bradner" fullname="S. Bradner">
<organization showOnFrontPage="true"/>
</author>
<date year="1997" month="March"/>
<abstract>
<t indent="0">In many standards track documents several words are
used to signify the requirements in the specification. These words are often ca
pitalized. This document defines these words as they should be interpreted in IE
TF documents. This document specifies an Internet Best Current Practices for th
e Internet Community, and requests discussion and suggestions for improvements.<
/t>
</abstract>
</front>
<seriesInfo name="BCP" value="14"/>
<seriesInfo name="RFC" value="2119"/>
<seriesInfo name="DOI" value="10.17487/RFC2119"/>
</reference>
<reference anchor="RFC4648" target="https://www.rfc-editor.org/info/rfc4
648" quoteTitle="true" derivedAnchor="RFC4648">
<front>
<title>The Base16, Base32, and Base64 Data Encodings</title>
<author initials="S." surname="Josefsson" fullname="S. Josefsson">
<organization showOnFrontPage="true"/>
</author>
<date year="2006" month="October"/>
<abstract>
<t indent="0">This document describes the commonly used base 64, b
ase 32, and base 16 encoding schemes. It also discusses the use of line-feeds i
n encoded data, use of padding in encoded data, use of non-alphabet characters i
n encoded data, use of different encoding alphabets, and canonical encodings. [
STANDARDS-TRACK]</t>
</abstract>
</front>
<seriesInfo name="RFC" value="4648"/>
<seriesInfo name="DOI" value="10.17487/RFC4648"/>
</reference>
<reference anchor="RFC5234" target="https://www.rfc-editor.org/info/rfc5
234" quoteTitle="true" derivedAnchor="RFC5234">
<front>
<title>Augmented BNF for Syntax Specifications: ABNF</title>
<author initials="D." surname="Crocker" fullname="D. Crocker" role="
editor">
<organization showOnFrontPage="true"/>
</author>
<author initials="P." surname="Overell" fullname="P. Overell">
<organization showOnFrontPage="true"/>
</author>
<date year="2008" month="January"/>
<abstract>
<t indent="0">Internet technical specifications often need to defi
ne a formal syntax. Over the years, a modified version of Backus-Naur Form (BNF
), called Augmented BNF (ABNF), has been popular among many Internet specificati
ons. The current specification documents ABNF. It balances compactness and simp
licity with reasonable representational power. The differences between standard
BNF and ABNF involve naming rules, repetition, alternatives, order-independence
, and value ranges. This specification also supplies additional rule definition
s and encoding for a core lexical analyzer of the type common to several Interne
t specifications. [STANDARDS-TRACK]</t>
</abstract>
</front>
<seriesInfo name="STD" value="68"/>
<seriesInfo name="RFC" value="5234"/>
<seriesInfo name="DOI" value="10.17487/RFC5234"/>
</reference>
<reference anchor="RFC7230" target="https://www.rfc-editor.org/info/rfc7
230" quoteTitle="true" derivedAnchor="RFC7230">
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Ro
uting</title>
<author initials="R." surname="Fielding" fullname="R. Fielding" role
="editor">
<organization showOnFrontPage="true"/>
</author>
<author initials="J." surname="Reschke" fullname="J. Reschke" role="
editor">
<organization showOnFrontPage="true"/>
</author>
<date year="2014" month="June"/>
<abstract>
<t indent="0">The Hypertext Transfer Protocol (HTTP) is a stateles
s application-level protocol for distributed, collaborative, hypertext informati
on systems. This document provides an overview of HTTP architecture and its ass
ociated terminology, defines the "http" and "https" Uniform Resource Identifier
(URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and
describes related security concerns for implementations.</t>
</abstract>
</front>
<seriesInfo name="RFC" value="7230"/>
<seriesInfo name="DOI" value="10.17487/RFC7230"/>
</reference>
<reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8
174" quoteTitle="true" derivedAnchor="RFC8174">
<front>
<title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</ti
tle>
<author initials="B." surname="Leiba" fullname="B. Leiba">
<organization showOnFrontPage="true"/>
</author>
<date year="2017" month="May"/>
<abstract>
<t indent="0">RFC 2119 specifies common key words that may be used
in protocol specifications. This document aims to reduce the ambiguity by cla
rifying that only UPPERCASE usage of the key words have the defined special mea
nings.</t>
</abstract>
</front>
<seriesInfo name="BCP" value="14"/>
<seriesInfo name="RFC" value="8174"/>
<seriesInfo name="DOI" value="10.17487/RFC8174"/>
</reference>
</references> </references>
<references> <references pn="section-7.2">
<name>Informative References</name> <name slugifiedName="name-informative-references">Informative References
<reference anchor="IEEE754" target="https://ieeexplore.ieee.org/document </name>
/8766229"> <reference anchor="IEEE754" target="https://ieeexplore.ieee.org/document
/8766229" quoteTitle="true" derivedAnchor="IEEE754">
<front> <front>
<title>IEEE Standard for Floating-Point Arithmetic</title> <title>IEEE Standard for Floating-Point Arithmetic</title>
<seriesInfo name="DOI" value="10.1109/IEEESTD.2019.8766229"/> <seriesInfo name="DOI" value="10.1109/IEEESTD.2019.8766229"/>
<seriesInfo name="IEEE" value="754-2019"/> <seriesInfo name="IEEE" value="754-2019"/>
<author> <author>
<organization>IEEE</organization> <organization showOnFrontPage="true">IEEE</organization>
</author> </author>
<date year="2019" month="July"/> <date year="2019" month="July"/>
</front> </front>
</reference> </reference>
<reference anchor="RFC7231" target="https://www.rfc-editor.org/info/rfc7
<reference anchor='STD63' target='https://www.rfc-editor.org/info/std63'> 231" quoteTitle="true" derivedAnchor="RFC7231">
<front> <front>
<title>UTF-8, a transformation format of ISO 10646</title> <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
<author initials='F.' surname='Yergeau' fullname='F. Yergeau'><organization /></ </title>
author> <author initials="R." surname="Fielding" fullname="R. Fielding" role
<date year='2003' month='November' /> ="editor">
</front> <organization showOnFrontPage="true"/>
<seriesInfo name='STD' value='63'/> </author>
<seriesInfo name='RFC' value='3629'/> <author initials="J." surname="Reschke" fullname="J. Reschke" role="
</reference> editor">
<organization showOnFrontPage="true"/>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer </author>
ence.RFC.7231.xml"/> <date year="2014" month="June"/>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer <abstract>
ence.RFC.7540.xml"/> <t indent="0">The Hypertext Transfer Protocol (HTTP) is a stateles
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer s \%application- level protocol for distributed, collaborative, hypertext inform
ence.RFC.7541.xml"/> ation systems. This document defines the semantics of HTTP/1.1 messages, as exp
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer ressed by request methods, request header fields, response status codes, and res
ence.RFC.8259.xml"/> ponse header fields, along with the payload of messages (metadata and body conte
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer nt) and mechanisms for content negotiation.</t>
ence.RFC.7493.xml"/> </abstract>
</front>
<seriesInfo name="RFC" value="7231"/>
<seriesInfo name="DOI" value="10.17487/RFC7231"/>
</reference>
<reference anchor="RFC7493" target="https://www.rfc-editor.org/info/rfc7
493" quoteTitle="true" derivedAnchor="RFC7493">
<front>
<title>The I-JSON Message Format</title>
<author initials="T." surname="Bray" fullname="T. Bray" role="editor
">
<organization showOnFrontPage="true"/>
</author>
<date year="2015" month="March"/>
<abstract>
<t indent="0">I-JSON (short for "Internet JSON") is a restricted p
rofile of JSON designed to maximize interoperability and increase confidence tha
t software can process it successfully with predictable results.</t>
</abstract>
</front>
<seriesInfo name="RFC" value="7493"/>
<seriesInfo name="DOI" value="10.17487/RFC7493"/>
</reference>
<reference anchor="RFC7540" target="https://www.rfc-editor.org/info/rfc7
540" quoteTitle="true" derivedAnchor="RFC7540">
<front>
<title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
<author initials="M." surname="Belshe" fullname="M. Belshe">
<organization showOnFrontPage="true"/>
</author>
<author initials="R." surname="Peon" fullname="R. Peon">
<organization showOnFrontPage="true"/>
</author>
<author initials="M." surname="Thomson" fullname="M. Thomson" role="
editor">
<organization showOnFrontPage="true"/>
</author>
<date year="2015" month="May"/>
<abstract>
<t indent="0">This specification describes an optimized expression
of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP
version 2 (HTTP/2). HTTP/2 enables a more efficient use of network resources a
nd a reduced perception of latency by introducing header field compression and a
llowing multiple concurrent exchanges on the same connection. It also introduce
s unsolicited push of representations from servers to clients.</t>
<t indent="0">This specification is an alternative to, but does no
t obsolete, the HTTP/1.1 message syntax. HTTP's existing semantics remain uncha
nged.</t>
</abstract>
</front>
<seriesInfo name="RFC" value="7540"/>
<seriesInfo name="DOI" value="10.17487/RFC7540"/>
</reference>
<reference anchor="RFC7541" target="https://www.rfc-editor.org/info/rfc7
541" quoteTitle="true" derivedAnchor="RFC7541">
<front>
<title>HPACK: Header Compression for HTTP/2</title>
<author initials="R." surname="Peon" fullname="R. Peon">
<organization showOnFrontPage="true"/>
</author>
<author initials="H." surname="Ruellan" fullname="H. Ruellan">
<organization showOnFrontPage="true"/>
</author>
<date year="2015" month="May"/>
<abstract>
<t indent="0">This specification defines HPACK, a compression form
at for efficiently representing HTTP header fields, to be used in HTTP/2.</t>
</abstract>
</front>
<seriesInfo name="RFC" value="7541"/>
<seriesInfo name="DOI" value="10.17487/RFC7541"/>
</reference>
<reference anchor="RFC8259" target="https://www.rfc-editor.org/info/rfc8
259" quoteTitle="true" derivedAnchor="RFC8259">
<front>
<title>The JavaScript Object Notation (JSON) Data Interchange Format
</title>
<author initials="T." surname="Bray" fullname="T. Bray" role="editor
">
<organization showOnFrontPage="true"/>
</author>
<date year="2017" month="December"/>
<abstract>
<t indent="0">JavaScript Object Notation (JSON) is a lightweight,
text-based, language-independent data interchange format. It was derived from t
he ECMAScript Programming Language Standard. JSON defines a small set of format
ting rules for the portable representation of structured data.</t>
<t indent="0">This document removes inconsistencies with other spe
cifications of JSON, repairs specification errors, and offers experience-based i
nteroperability guidance.</t>
</abstract>
</front>
<seriesInfo name="STD" value="90"/>
<seriesInfo name="RFC" value="8259"/>
<seriesInfo name="DOI" value="10.17487/RFC8259"/>
</reference>
<reference anchor="STD63" target="https://www.rfc-editor.org/info/std63"
quoteTitle="true" derivedAnchor="STD63">
<front>
<title>UTF-8, a transformation format of ISO 10646</title>
<author initials="F." surname="Yergeau" fullname="F. Yergeau">
<organization showOnFrontPage="true"/>
</author>
<date year="2003" month="November"/>
</front>
<seriesInfo name="STD" value="63"/>
<seriesInfo name="RFC" value="3629"/>
</reference>
</references> </references>
</references> </references>
<section anchor="faq"> <section anchor="faq" numbered="true" removeInRFC="false" toc="include" pn="
<name>Frequently Asked Questions</name> section-appendix.a">
<section anchor="why-not-json"> <name slugifiedName="name-frequently-asked-questions">Frequently Asked Que
<name>Why Not JSON?</name> stions</name>
<t>Earlier proposals for Structured Fields were based upon JSON <xref ta <section anchor="why-not-json" numbered="true" removeInRFC="false" toc="in
rget="RFC8259"/>. However, constraining its use to clude" pn="section-a.1">
<name slugifiedName="name-why-not-json">Why Not JSON?</name>
<t indent="0" pn="section-a.1-1">Earlier proposals for Structured Fields
were based upon JSON <xref target="RFC8259" format="default" sectionFormat="of"
derivedContent="RFC8259"/>. However, constraining its use to
make it suitable for HTTP header fields required senders and make it suitable for HTTP header fields required senders and
recipients to implement specific additional handling.</t> recipients to implement specific additional handling.</t>
<t>For example, JSON has specification issues around large numbers and <t indent="0" pn="section-a.1-2">For example, JSON has specification iss ues around large numbers and
objects with duplicate members. Although advice for avoiding these objects with duplicate members. Although advice for avoiding these
issues is available (e.g., <xref target="RFC7493"/>), issues is available (e.g., <xref target="RFC7493" format="default" sectio nFormat="of" derivedContent="RFC7493"/>),
it cannot be relied upon.</t> it cannot be relied upon.</t>
<t>Likewise, JSON strings are by default Unicode strings, which have a <t indent="0" pn="section-a.1-3">Likewise, JSON strings are by default U nicode strings, which have a
number of potential interoperability issues (e.g., in number of potential interoperability issues (e.g., in
comparison). Although implementers can be advised to avoid non-ASCII comparison). Although implementers can be advised to avoid non-ASCII
content where unnecessary, this is difficult to enforce.</t> content where unnecessary, this is difficult to enforce.</t>
<t>Another example is JSON's ability to nest content to arbitrary <t indent="0" pn="section-a.1-4">Another example is JSON's ability to ne st content to arbitrary
depths. Since the resulting memory commitment might be unsuitable depths. Since the resulting memory commitment might be unsuitable
(e.g., in embedded and other limited server deployments), it's (e.g., in embedded and other limited server deployments), it's
necessary to limit it in some fashion; however, existing JSON necessary to limit it in some fashion; however, existing JSON
implementations have no such limits, and even if a limit is specified, implementations have no such limits, and even if a limit is specified,
it's likely that some field definition will find a need to violate it's likely that some field definition will find a need to violate
it.</t> it.</t>
<t>Because of JSON's broad adoption and implementation, it is <t indent="0" pn="section-a.1-5">Because of JSON's broad adoption and im plementation, it is
difficult to impose such additional constraints across all difficult to impose such additional constraints across all
implementations; some deployments would fail to enforce them, thereby implementations; some deployments would fail to enforce them, thereby
harming interoperability. In short, if it looks like JSON, people will harming interoperability. In short, if it looks like JSON, people will
be tempted to use a JSON parser/serializer on field values.</t> be tempted to use a JSON parser/serializer on field values.</t>
<t>Since a major goal for Structured Fields is to improve <t indent="0" pn="section-a.1-6">Since a major goal for Structured Field s is to improve
interoperability and simplify implementation, these concerns led to a interoperability and simplify implementation, these concerns led to a
format that requires a dedicated parser and serializer.</t> format that requires a dedicated parser and serializer.</t>
<t>Additionally, there were widely shared feelings that JSON doesn't <t indent="0" pn="section-a.1-7">Additionally, there were widely shared feelings that JSON doesn't
"look right" in HTTP fields.</t> "look right" in HTTP fields.</t>
</section> </section>
</section> </section>
<section anchor="implementation-notes"> <section anchor="implementation-notes" numbered="true" removeInRFC="false" t
<name>Implementation Notes</name> oc="include" pn="section-appendix.b">
<t>A generic implementation of this specification should expose the <name slugifiedName="name-implementation-notes">Implementation Notes</name
top-level serialize (<xref target="text-serialize"/>) >
and parse (<xref target="text-parse"/>) functions. They <t indent="0" pn="section-appendix.b-1">A generic implementation of this s
pecification should expose the
top-level serialize (<xref target="text-serialize" format="default" sectio
nFormat="of" derivedContent="Section 4.1"/>)
and parse (<xref target="text-parse" format="default" sectionFormat="of" d
erivedContent="Section 4.2"/>) functions. They
need not be functions; for example, it could be implemented as an need not be functions; for example, it could be implemented as an
object, with methods for each of the different top-level types.</t> object, with methods for each of the different top-level types.</t>
<t>For interoperability, it's important that generic implementations be <t indent="0" pn="section-appendix.b-2">For interoperability, it's importa
complete and follow the algorithms closely; see <xref target="strict"/>. T nt that generic implementations be
o aid this, a common test suite is being maintained complete and follow the algorithms closely; see <xref target="strict" form
at="default" sectionFormat="of" derivedContent="Section 1.1"/>. To aid this, a c
ommon test suite is being maintained
by the community at <eref brackets="angle" target="https://github.com/http wg/structured-field-tests"/>.</t> by the community at <eref brackets="angle" target="https://github.com/http wg/structured-field-tests"/>.</t>
<t>Implementers should note that Dictionaries and Parameters are <t indent="0" pn="section-appendix.b-3">Implementers should note that Dict ionaries and Parameters are
order-preserving maps. Some fields may not convey meaning in the order-preserving maps. Some fields may not convey meaning in the
ordering of these data types, but it should still be exposed so ordering of these data types, but it should still be exposed so
that it will be available to applications that need to use it.</t> that it will be available to applications that need to use it.</t>
<t>Likewise, implementations should note that it's important to preserve <t indent="0" pn="section-appendix.b-4">Likewise, implementations should n ote that it's important to preserve
the distinction between Tokens and Strings. While most programming the distinction between Tokens and Strings. While most programming
languages have native types that map to the other types well, it may be languages have native types that map to the other types well, it may be
necessary to create a wrapper "token" object or use a parameter on necessary to create a wrapper "token" object or use a parameter on
functions to assure that these types remain separate.</t> functions to assure that these types remain separate.</t>
<t>The serialization algorithm is defined in a way that it is not <t indent="0" pn="section-appendix.b-5">The serialization algorithm is def
strictly limited to the data types defined in <xref target="types"/> in ev ined in a way that it is not
ery case. For example, Decimals are designed to strictly limited to the data types defined in <xref target="types" format=
"default" sectionFormat="of" derivedContent="Section 3"/> in every case. For exa
mple, Decimals are designed to
take broader input and round to allowed values.</t> take broader input and round to allowed values.</t>
<t>Implementations are allowed to limit the size of different <t indent="0" pn="section-appendix.b-6">Implementations are allowed to lim it the size of different
structures, subject to the minimums defined for each type. When a structures, subject to the minimums defined for each type. When a
structure exceeds an implementation limit, that structure fails parsing structure exceeds an implementation limit, that structure fails parsing
or serialization.</t> or serialization.</t>
</section> </section>
<section numbered="false" anchor="acknowledgements"> <section numbered="false" anchor="acknowledgements" removeInRFC="false" toc=
<name>Acknowledgements</name> "include" pn="section-appendix.c">
<t>Many thanks to <contact fullname="Matthew Kerwin"/> for his detailed fe <name slugifiedName="name-acknowledgements">Acknowledgements</name>
edback and careful <t indent="0" pn="section-appendix.c-1">Many thanks to <contact fullname="
Matthew Kerwin"/> for his detailed feedback and careful
consideration during the development of this specification.</t> consideration during the development of this specification.</t>
<t>Thanks also to <contact fullname="Ian Clelland"/>, <contact fullname="R oy Fielding"/>, <contact fullname="Anne van Kesteren"/>, <t indent="0" pn="section-appendix.c-2">Thanks also to <contact fullname=" Ian Clelland"/>, <contact fullname="Roy Fielding"/>, <contact fullname="Anne van Kesteren"/>,
<contact fullname="Kazuho Oku"/>, <contact fullname="Evert Pot"/>, <contact fullname="Kazuho Oku"/>, <contact fullname="Evert Pot"/>,
<contact fullname="Julian Reschke"/>, <contact fullname="Martin Thom son"/>, <contact fullname="Mike West"/>, and <contact fullname="Jeffrey Yasskin" /> for their contributions.</t> <contact fullname="Julian Reschke"/>, <contact fullname="Martin Thom son"/>, <contact fullname="Mike West"/>, and <contact fullname="Jeffrey Yasskin" /> for their contributions.</t>
</section> </section>
<section anchor="authors-addresses" numbered="false" removeInRFC="false" toc
="include" pn="section-appendix.d">
<name slugifiedName="name-authors-addresses">Authors' Addresses</name>
<author initials="M." surname="Nottingham" fullname="Mark Nottingham">
<organization showOnFrontPage="true">Fastly</organization>
<address>
<postal>
<city>Prahran</city>
<region>VIC</region>
<country>Australia</country>
</postal>
<email>mnot@mnot.net</email>
<uri>https://www.mnot.net/</uri>
</address>
</author>
<author initials="P-H." surname="Kamp" fullname="Poul-Henning Kamp">
<organization showOnFrontPage="true">The Varnish Cache Project</organiza
tion>
<address>
<email>phk@varnish-cache.org</email>
</address>
</author>
</section>
</back> </back>
</rfc> </rfc>
 End of changes. 341 change blocks. 
864 lines changed or deleted 1900 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/