1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
<pre>Internet Engineering Task Force (IETF) P. Kyzivat
Request for Comments: 7405 December 2014
Updates: <a href="./rfc5234">5234</a>
Category: Standards Track
ISSN: 2070-1721
<span class="h1">Case-Sensitive String Support in ABNF</span>
Abstract
This document extends the base definition of ABNF (Augmented Backus-
Naur Form) to include a way to specify US-ASCII string literals that
are matched in a case-sensitive manner.
Status of This Memo
This is an Internet Standards Track document.
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 <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc7405">http://www.rfc-editor.org/info/rfc7405</a>.
Copyright Notice
Copyright (c) 2014 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) 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.
<span class="grey">Kyzivat Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc7405">RFC 7405</a> Case-Sensitive String Support in ABNF December 2014</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-2">2</a>. Updates to <a href="./rfc5234">RFC 5234</a> . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-2.1">2.1</a>. Terminal Values - Literal Text Strings . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-2.2">2.2</a>. ABNF Definition of ABNF - char-val . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-3">3</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-4">4</a>. Normative References . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
The base definition of ABNF (Augmented Backus-Naur Form) supports US-
ASCII string literals. The matching of these literals is done in a
case-insensitive manner. While this is often the desired behavior,
in some situations, case-sensitive matching of string literals is
needed. Literals for case-sensitive matching must be specified using
the numeric representation of those characters, which is inconvenient
and error prone both to write and read.
This document extends ABNF to have two different types of US-ASCII
string literals. One type is matched using case-sensitive matching,
while the other is matched using case-insensitive matching. These
types are denoted using type prefixes similar to the type prefixes
used with numeric values. If no prefix is used, then case-
insensitive matching is used (as is consistent with previous
behavior).
This document is structured as a set of changes to the full ABNF
specification [<a href="./rfc5234" title=""Augmented BNF for Syntax Specifications: ABNF"">RFC5234</a>].
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Updates to <a href="./rfc5234">RFC 5234</a></span>
This document makes changes to two parts of [<a href="./rfc5234" title=""Augmented BNF for Syntax Specifications: ABNF"">RFC5234</a>]. The two
changes are as follows:
o Replace the last half of <a href="./rfc5234#section-2.3">Section 2.3 of [RFC5234]</a> (beginning with
"ABNF permits the specification of literal text strings") with the
contents of <a href="#section-2.1">Section 2.1</a>.
o Replace the <char-val> rule in <a href="./rfc5234#section-4">Section 4 of [RFC5234]</a> with the
contents of <a href="#section-2.2">Section 2.2</a>.
<span class="grey">Kyzivat Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc7405">RFC 7405</a> Case-Sensitive String Support in ABNF December 2014</span>
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Terminal Values - Literal Text Strings</span>
ABNF permits the specification of literal text strings directly,
enclosed in quotation marks. Hence:
command = "command string"
Literal text strings are interpreted as a concatenated set of
printable characters.
NOTE:
The character set for these strings is US-ASCII.
Literal text strings in ABNF may be either case sensitive or case
insensitive. The form of matching used with a literal text string is
denoted by a prefix to the quoted string. The following prefixes are
allowed:
%s = case-sensitive
%i = case-insensitive
To be consistent with prior implementations of ABNF, having no prefix
means that the string is case insensitive and is equivalent to having
the "%i" prefix.
Hence:
rulename = %i"aBc"
and:
rulename = "abc"
will both match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC", and
"ABC".
In contrast:
rulename = %s"aBc"
will match only "aBc" and will not match "abc", "Abc", "abC", "ABc",
"aBC", "AbC", or "ABC".
In the past, the numerical specification of individual characters was
used to define a case-sensitive rule.
<span class="grey">Kyzivat Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc7405">RFC 7405</a> Case-Sensitive String Support in ABNF December 2014</span>
For example:
rulename = %d97 %d98 %d99
or
rulename = %x61.62.63
will match only the string that comprises only the lowercase
characters, abc. Using a literal text string with a prefix has a
clear readability advantage over the old way.
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. ABNF Definition of ABNF - char-val</span>
char-val = case-insensitive-string /
case-sensitive-string
case-insensitive-string =
[ "%i" ] quoted-string
case-sensitive-string =
"%s" quoted-string
quoted-string = DQUOTE *(%x20-21 / %x23-7E) DQUOTE
; quoted string of SP and VCHAR
; without DQUOTE
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Security Considerations</span>
Security is truly believed to be irrelevant to this document.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Normative References</span>
[<a id="ref-RFC5234">RFC5234</a>] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, <a href="./rfc5234">RFC 5234</a>, January 2008,
<http:/www.rfc-editor.org/info/rfc5234>.
Author's Address
Paul Kyzivat
Massachusetts
United States
EMail: pkyzivat@alum.mit.edu
Kyzivat Standards Track [Page 4]
</pre>
|