#?SuikaWiki/0.9 page-icon="HTTP" [[#comment]] * 仕様書から ** RFC 1945 (HTTP/1.0); RFC 2068・2616 (HTTP/1.1) 4.2 Message Headers > HTTP header fields, which include [DEL[General-Header (Section 4.3)]] [INS[general-header (section 4.5)]], [DEL[Request-Header (Section 5.2)]] [INS[request-header (section 5.3)]], [DEL[Response-Header (Section 6.2)]] [INS[response-header (section 6.2)]], and [DEL[Entity-Header (Section 7.1)]] [INS[entity-header (section 7.1)]] fields, follow the same generic format as that given in Section 3.1 of RFC 822 [DEL[ [7] ]] [INS[ [9] ]]. Each header field consists of a name followed [DEL[immediately]] by a colon (":")[DEL[, a single space (SP) character,]] and the field value. Field names are case-insensitive. [INS[The field value [DEL[may]] [INS[MAY]] be preceded by any amount of LWS, though a single SP is preferred.]] Header fields can be extended over multiple lines by preceding each extra line with at least one SP or HT[DEL[, though this is not recommended]]. [INS[Applications [DEL[SHOULD]] [INS[ought to]] follow "common form"[INS[, where one is known or indicated,]] when generating HTTP constructs, since there might exist some implementations that fail to accept anything beyond the common forms.]] [DFN[HTTP 頭欄]]は、[[一般頭欄]], [[要求頭欄]], [[応答頭欄]], [[実体頭欄]]を含みますが、 [[RFC822]] の3.1節にある同じ一般書式に従います。 各頭欄は名前、それに[DEL[すぐに]]続くコロン ([CODE(HTTP)[:]])、[DEL[1つの[[間隔]] ([[SP]]) 文字、]]欄値から成ります。 欄名は大文字・小文字を区別しません。[INS[欄値の前には任意の量の [CODE(ABNF)[[[LWS]]]] があって'''構いません'''。しかし [CODE(ABNF)[[[SP]]]] 1つが好ましいです。]] 頭欄は、それぞれの余分な行に最低1つの [CODE(ABNF)[[[SP]]]] または [CODE(ABNF)[[[HT]]]] を入れることで複数行に展開できます。[DEL[ただしこれは推奨しません。]] [INS[応用は、 HTTP 構造体を生成する時に、 [INS[(それが知られているかまたは示されている時には)]]「共通形」に従うべきです。そうしないと、共通形以外のものを受け入れてくれない実装が存在するかもしれません。]] > -[DEL[ HTTP-header = field-name ":" [ field-value ] CRLF]] -[INS[ message-header = field-name ":" [ field-value ] [DEL[CRLF]]]] > -field-name = token -field-value = *( field-content | LWS ) -field-content = [INS[ >[INS[{2616}]] The field-content does not include any leading or trailing LWS: linear white space occurring before the first non-whitespace character of the field-value or after the last non-whitespace character of the field-value. Such leading or trailing LWS MAY be removed without changing the semantics of the field value. Any LWS that occurs between field-content MAY be replaced with a single SP before interpreting the field value or forwarding the message downstream. [CODE(ABNF)[field-content]] は最初や最後の [CODE(ABNF)[LWS]]、つまり [CODE(ABNF)[field-value]] の最初の非空白文字の前や最後の非空白文字の後の[[線形空白]]を含みません。 この最初や最後の [CODE(ABNF)[LWS]] は欄値の意味を変えずに削除して'''構いません'''。 [CODE(ABNF)[field-content]] の間に現れる任意の [CODE(ABNF)[LWS]] は欄値を解釈したりメッセージを[[下流]]に転送したりする前に1つの [CODE(ABNF)[SP]] に置換しても'''構いません'''。 ]INS] > The order in which header fields [INS[with differing field names]] are received is not significant. However, it is "good practice" to send [DEL[General-Header]] [INS[general-header]] fields first, followed by [DEL[Request-Header]] [INS[request-header]] or [DEL[Response-Header]] [INS[response-header]] fields[INS[, and ending with]] [DEL[prior to]] the [DEL[Entity-Header]] [INS[entity-header]] fields. どの順序で[INS[名前の異なる]]頭欄を受信したかは重要ではありません。 しかし、一般頭欄を最初に送り、続けて要求頭欄または応答頭欄を実体頭欄の前に送るのが 「[[良い習慣]]」です。 > Multiple [DEL[HTTP-header]] [INS[message-header]] fields with the same field-name [DEL[[INS[{1945,2068}]] may]] [INS[[INS[{2616}]] MAY]] be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It [DEL[must]] [INS[MUST]] be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. [INS[The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded.]] 同じ [CODE(ABNF)[field-name]] の複数の [CODE(ABNF)[message-header]] は、その頭欄の [CODE(ABNF)[field-value]] 全体が読点分離並び (つまり [CODE(ABNF)[#([VAR[values]])]]) として定義されているときに、 この場合に限って出現して'''構いません'''。 各後続 [CODE(ABNF)[field-value]] を最初のものに、それぞれ読点で分離して後置することによって、 メッセージの意味を変えずに複数の頭欄を一つの [SAMP(HTTP)[[VAR[field-name]]: [VAR[field-value]]]] 組に結合することが可能でなければ'''なりません'''。 [INS[ 注: 注記なき追加・削除は 1945→2068 の差分。 追加部分の中の追加・削除は 2068→2616 の差分。 ]INS] ** RFC の部分のライセンス [[RFCのライセンス]] * メモ