RFC中的“*”(星号)是什么意思?

时间:2018-01-03 12:46:12

标签: http rfc

引自https://tools.ietf.org/html/rfc5987#section-3.2.1

  

为了包括字符集和语言信息,这个   规范将RFC 2616语法修改为:

 parameter     = reg-parameter / ext-parameter

 reg-parameter = parmname LWSP "=" LWSP value

 ext-parameter = parmname "*" LWSP "=" LWSP ext-value

 parmname      = 1*attr-char

 ext-value     = charset  "'" [ language ] "'" value-chars
               ; like RFC 2231's <extended-initial-value>
               ; (see [RFC2231], Section 7)

 charset       = "UTF-8" / "ISO-8859-1" / mime-charset

 mime-charset  = 1*mime-charsetc

*parmname = 1*attr-char的含义是什么?还有同样的问题mime-charset = 1*mime-charsetc

我所知道的是"*"*中正好表示ext-parameter = parmname "*" LWSP "=" LWSP ext-value本身,因为RFC显示了ext-parameter = parmname "*" LWSP "=" LWSP ext-value后面的示例:

  

标题* =异8859-1'en'%A3%20rates

2 个答案:

答案 0 :(得分:1)

它是一个描述有效重复次数的量词。

  

&#34; 1 *元件&#34;需要至少一个元素。

请参阅RFC 2616 section 2.1 - 增强型BNF:

*rule
      The character "*" preceding an element indicates repetition. The
      full form is "<n>*<m>element" indicating at least <n> and at most
      <m> occurrences of element. Default values are 0 and infinity so
      that "*(element)" allows any number, including zero; "1*element"
      requires at least one; and "1*2element" allows one or two.

答案 1 :(得分:1)

你引用的规范说:

  

本规范使用ABNF(Augmented Backus-Naur Form)   [RFC5234]中定义的符号。包括以下核心规则   通过引用,如[RFC5234],附录B.1:ALPHA(字母)中所定义,   DIGIT(十进制0-9),HEXDIG(十六进制0-9 / A-F / a-f)和LWSP
  (线性空白)。

转到RFC 5234,您将找到https://tools.ietf.org/html/rfc5234#section-3.6