【问题标题】:What does "*" (asterisk) mean in RFC?RFC 中的“*”(星号)是什么意思?
【发布时间】:2018-01-03 12:46:11
【问题描述】:

引用https://www.rfc-editor.org/rfc/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 后面的示例:

title*=iso-8859-1'en'%A3%20rates

【问题讨论】:

    标签: http rfc


    【解决方案1】:

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

    “1*element”至少需要一个元素。

    参见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.
    

    【讨论】:

      【解决方案2】:

      你引用的规范说:

      本规范使用 ABNF(增广巴科斯-瑙尔形式)
      [RFC5234] 中定义的符号。包括以下核心规则 通过引用,如 [RFC5234] 中定义的,附录 B.1:ALPHA(字母), DIGIT(十进制 0-9)、HEXDIG(十六进制 0-9/A-F/a-f)和 LWSP
      (线性空格)。

      转到 RFC 5234,您会找到 https://www.rfc-editor.org/rfc/rfc5234#section-3.6

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-10-20
        • 2010-10-09
        • 1970-01-01
        • 2018-08-04
        • 2011-05-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多