Internet Engineering Task Force (IETF) P. Kyzivat Request for Comments: 7405 December 2014 Updates: 5234 Category: Standards Track ISSN: 2070-1721
Internet Engineering Task Force (IETF) P. Kyzivat Request for Comments: 7405 December 2014 Updates: 5234 Category: Standards Track ISSN: 2070-1721
Case-Sensitive String Support in ABNF
ABNF中区分大小写的字符串支持
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.
本文档扩展了ABNF(扩展的Backus Naur表单)的基本定义,包括一种指定以区分大小写的方式匹配的US-ASCII字符串文本的方法。
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 Section 2 of RFC 5741.
本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7405.
有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc7405.
Copyright Notice
版权公告
Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved.
版权所有(c)2014 IETF信托基金和确定为文件作者的人员。版权所有。
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) 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.
本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。
Table of Contents
目录
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Updates to RFC 5234 . . . . . . . . . . . . . . . . . . . . . 2 2.1. Terminal Values - Literal Text Strings . . . . . . . . . 3 2.2. ABNF Definition of ABNF - char-val . . . . . . . . . . . 4 3. Security Considerations . . . . . . . . . . . . . . . . . . . 4 4. Normative References . . . . . . . . . . . . . . . . . . . . 4 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 4
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Updates to RFC 5234 . . . . . . . . . . . . . . . . . . . . . 2 2.1. Terminal Values - Literal Text Strings . . . . . . . . . 3 2.2. ABNF Definition of ABNF - char-val . . . . . . . . . . . 4 3. Security Considerations . . . . . . . . . . . . . . . . . . . 4 4. Normative References . . . . . . . . . . . . . . . . . . . . 4 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 4
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.
ABNF(增强的Backus-Naur表单)的基本定义支持US-ASCII字符串文本。这些文本的匹配是以不区分大小写的方式完成的。虽然这通常是理想的行为,但在某些情况下,需要对字符串文本进行区分大小写的匹配。区分大小写匹配的文本必须使用这些字符的数字表示形式来指定,这既不方便,也容易出错。
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).
本文档扩展ABNF,使其具有两种不同类型的US-ASCII字符串文字。一种类型使用区分大小写的匹配进行匹配,而另一种类型使用不区分大小写的匹配进行匹配。这些类型使用类型前缀表示,类似于与数值一起使用的类型前缀。如果不使用前缀,则使用不区分大小写的匹配(与前面的行为一致)。
This document is structured as a set of changes to the full ABNF specification [RFC5234].
本文件的结构是对完整ABNF规范[RFC5234]的一系列修改。
This document makes changes to two parts of [RFC5234]. The two changes are as follows:
本文件对[RFC5234]的两部分进行了修改。两项改变如下:
o Replace the last half of Section 2.3 of [RFC5234] (beginning with "ABNF permits the specification of literal text strings") with the contents of Section 2.1.
o 将[RFC5234]第2.3节的后半部分(以“ABNF允许指定文字字符串”开头)替换为第2.1节的内容。
o Replace the <char-val> rule in Section 4 of [RFC5234] with the contents of Section 2.2.
o 将[RFC5234]第4节中的<char val>规则替换为第2.2节的内容。
ABNF permits the specification of literal text strings directly, enclosed in quotation marks. Hence:
ABNF允许直接指定文字文本字符串,并用引号括起来。因此:
command = "command string"
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.
这些字符串的字符集是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:
ABNF中的文字文本字符串可能区分大小写或不区分大小写。与文字文本字符串一起使用的匹配形式由带引号字符串的前缀表示。允许使用以下前缀:
%s = case-sensitive %i = case-insensitive
%s=区分大小写%i=不区分大小写
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.
为了与ABNF以前的实现保持一致,没有前缀意味着字符串不区分大小写,相当于有“%i”前缀。
Hence:
因此:
rulename = %i"aBc"
rulename = %i"aBc"
and:
以及:
rulename = "abc"
rulename = "abc"
will both match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC", and "ABC".
两者都将匹配“abc”、“abc”、“abc”、“abc”、“abc”、“abc”、“abc”、“abc”、“abc”和“abc”。
In contrast:
相反:
rulename = %s"aBc"
rulename = %s"aBc"
will match only "aBc" and will not match "abc", "Abc", "abC", "ABc", "aBC", "AbC", or "ABC".
只匹配“aBc”,不匹配“aBc”、“aBc”、“aBc”、“aBc”、“aBc”、“aBc”、“aBc”或“aBc”。
In the past, the numerical specification of individual characters was used to define a case-sensitive rule.
过去,单个字符的数字规格用于定义区分大小写的规则。
For example:
例如:
rulename = %d97 %d98 %d99
rulename = %d97 %d98 %d99
or
或
rulename = %x61.62.63
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.
将仅匹配仅包含小写字符abc的字符串。与旧方法相比,使用带有前缀的文本字符串具有明显的可读性优势。
char-val = case-insensitive-string / case-sensitive-string
char val=不区分大小写的字符串/区分大小写的字符串
case-insensitive-string = [ "%i" ] quoted-string
不区分大小写的字符串=[%i”]带引号的字符串
case-sensitive-string = "%s" quoted-string
区分大小写的字符串=“%s”带引号的字符串
quoted-string = DQUOTE *(%x20-21 / %x23-7E) DQUOTE ; quoted string of SP and VCHAR ; without DQUOTE
quoted-string = DQUOTE *(%x20-21 / %x23-7E) DQUOTE ; quoted string of SP and VCHAR ; without DQUOTE
Security is truly believed to be irrelevant to this document.
安全性确实被认为与本文件无关。
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008, <http:/www.rfc-editor.org/info/rfc5234>.
[RFC5234]Crocker,D.和P.Overell,“语法规范的增广BNF:ABNF”,STD 68,RFC 5234,2008年1月,<http://www.RFC-editor.org/info/rfc52234>。
Author's Address
作者地址
Paul Kyzivat Massachusetts United States
美国马萨诸塞州保罗·基齐瓦特
EMail: pkyzivat@alum.mit.edu
EMail: pkyzivat@alum.mit.edu