7Internet Engineering Task Force (IETF)                        P. Kyzivat
 
8Request for Comments: 7405                                 December 2014
 
10Category: Standards Track
 
14                 Case-Sensitive String Support in ABNF
 
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.
 
24   This is an Internet Standards Track document.
 
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.
 
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.
 
38   Copyright (c) 2014 IETF Trust and the persons identified as the
 
39   document authors.  All rights reserved.
 
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.
 
58Kyzivat                      Standards Track                    [Page 1]
 
60RFC 7405          Case-Sensitive String Support in ABNF    December 2014
 
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
 
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.
 
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
 
91   This document is structured as a set of changes to the full ABNF
 
92   specification [RFC5234].
 
96   This document makes changes to two parts of [RFC5234].  The two
 
97   changes are as follows:
 
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.
 
103   o  Replace the <char-val> rule in Section 4 of [RFC5234] with the
 
104      contents of Section 2.2.
 
114Kyzivat                      Standards Track                    [Page 2]
 
116RFC 7405          Case-Sensitive String Support in ABNF    December 2014
 
1192.1.  Terminal Values - Literal Text Strings
 
121   ABNF permits the specification of literal text strings directly,
 
122   enclosed in quotation marks.  Hence:
 
124         command     =  "command string"
 
126   Literal text strings are interpreted as a concatenated set of
 
127   printable characters.
 
131   The character set for these strings is US-ASCII.
 
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
 
139         %i          =  case-insensitive
 
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
 
153   will both match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC", and
 
160   will match only "aBc" and will not match "abc", "Abc", "abC", "ABc",
 
161   "aBC", "AbC", or "ABC".
 
163   In the past, the numerical specification of individual characters was
 
164   used to define a case-sensitive rule.
 
170Kyzivat                      Standards Track                    [Page 3]
 
172RFC 7405          Case-Sensitive String Support in ABNF    December 2014
 
177         rulename    =  %d97 %d98 %d99
 
181         rulename    =  %x61.62.63
 
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.
 
1872.2.  ABNF Definition of ABNF - char-val
 
189         char-val       =  case-insensitive-string /
 
190                           case-sensitive-string
 
192         case-insensitive-string =
 
193                           [ "%i" ] quoted-string
 
195         case-sensitive-string =
 
198         quoted-string  =  DQUOTE *(%x20-21 / %x23-7E) DQUOTE
 
199                                ; quoted string of SP and VCHAR
 
2023.  Security Considerations
 
204   Security is truly believed to be irrelevant to this document.
 
2064.  Normative References
 
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>.
 
218   EMail: pkyzivat@alum.mit.edu
 
226Kyzivat                      Standards Track                    [Page 4]