2014-12-04 26 views
1

我正在閱讀W3C HTTP header spec以查找某些HTTP標頭的確切格式。像大多數規格一樣,HTTP標頭規格使用BNF來正式指示特定的標頭格式。W3C HTTP規範中「1#」標記的展開

但我困惑的「1#」令牌的使用,如:

Cache-Control = "Cache-Control" ":" 1#cache-directive 

鑑於背景下,似乎預示着一個逗號分隔的列表。但是我從來沒有見過這個令牌用過,我找不到它的定義。規範本身並沒有按照我所能看到的來定義它。

當然,我不幸的是不能簡單地爲這種事情做一個Google search。由於查詢解析器的侷限性,即使是全球性的商業級搜索引擎也無法生成我想要的信息,這是極少數情況之一。

回答

1

來源:RFC2616 Chapter 2.1 Augmented BNF

A construct "#" is defined, similar to "*", for defining lists of 
    elements. The full form is "<n>#<m>element" indicating at least 
    <n> and at most <m> elements, each separated by one or more commas 
    (",") and OPTIONAL linear white space (LWS). This makes the usual 
    form of lists very easy; a rule such as 
    (*LWS element *(*LWS "," *LWS element)) 
    can be shown as 
    1#element 
    Wherever this construct is used, null elements are allowed, but do 
    not contribute to the count of elements present. That is, 
    "(element), , (element) " is permitted, but counts as only two 
    elements. Therefore, where at least one element is required, at 
    least one non-null element MUST be present. 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. 

編輯:原來的問題相連,qoutes此答案是基於RFC 2616。然而,引用的RFC在今年已經被一些較新的RFC廢棄了。 1#令牌的定義已在RFC7030中更新。請參閱here的規範來源和here的答案,以便提及此更改。請也知道,關於相關通道的勘誤存在here