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