#?SuikaWiki/0.9 - [1] [[注釈]]などと訳します。 - [2] 2002-11-09 (土) 15:52 ''[[名無しさん]]'' age [[#comment]] *RFC 822/2822 電子メイル・メッセージ **RFC 822 3.4.2 COMMENTS (抜粋) >If a comment is to be "folded" onto multiple lines, then the syntax for folding must be adhered to. (See the "Lexical Analysis of Messages" section on "Folding Long Header Fields" above, and the section on "Case Independence" below.) Note that the official semantics therefore do not "see" any unquoted CRLFs that are in comments, although particular parsing programs may wish to note their presence. For these programs, it would be reasonable to interpret a "CRLF LWSP-char" as being a CRLF that is part of the comment; i.e., the CRLF is kept and the LWSP-char is discarded. Quoted CRLFs (i.e., a backslash followed by a CR followed by a LF) still must be followed by at least one LWSP-char. [3] [CODE(ABNF)[comment]] が複数行に「折畳まれている」時は、折畳みの構文をくっつけないといけません。 (上の「長い頭領域の折畳み」の「メッセージの単語分析」の節と、下の「大文字・小文字の区別性」の節を参照。) 従って、公式な意味においては [CODE(ABNF)[comment]] 中にある quote されていない [CODE(ABNF)[CRLF]] を「見る」ことはありません。 但しそうしたものの出現に注意したいと思う解析プログラムもあることでしょう。 そうしたプログラムでは、「[CODE(ABNF)[CRLF LWSP-char]]」を [CODE(ABNF)[CRLF]] が [CODE(ABNF)[comment]] の一部であると 解釈する、つまり [CODE(ABNF)[CRLF]] は残して, [CODE(ABNF)[LWSP-char]] を棄てるのが適切かもしれません。 Quote された [CODE(ABNF)[CRLF LWSP-char]] (すなわち、 逆斜線に [CODE(ABNF)[CR]] が続いて、 [CODE(ABNF)[LF]] が続くもの) は依然、最低一つの [CODE(ABNF)[LWSP-char]] が後に続かなければなりません。 **文脈 [25] [[RFC822]] メッセージでは、 [CODE(ABNF)[comment]] は[[構造化欄]]の要素間であればどこにでも挿入出来、 [CODE(ABNF)[linear-white-space]] 1個と透過であるとみなされます。 [26] [[RFC2822]] では [CODE(ABNF)[obsolete-]] 構文 (受信メッセージ解析用。) では RFC 822 (>>25) と同じですが、 [CODE(ABNF)[obsolete-]] でない構文 (新規メッセージ送信用。) では特定の場所 (RFC 2822 の [[ABNF]] 構文で [[CFWS]] とされた場所。) でしか使えません。 [[#comment]] **メモ [[#comment]] *HTTP メッセージ [4] [[RFC2616]] ([[HTTP/1.1]]) によると: -[5] comment = "(" *( ctext | quoted-pair | comment ) ")" -[6] ctext = ところがこれでは [CODE(ABNF)[quoted-pair]] と [CODE(ABNF)[ctext]] が区別出来ない。 822 同様に [CODE(ABNF)["\"]] も除いた方がよさげ。でも直ぐ後に、 > The backslash character ("\") MAY be used as a single-character quoting mechanism only within quoted-string and comment constructs. 「単一文字 quote 機構として使っても'''よい'''」と書いてある。 てことは「として使」わなくてもいいてこと? [6] とか言ってもどーしよーもないので、やっぱり quote 以外には使えないことにする。 -[7] http1.1.comment = "(" http1.1.ccontent ")" -[8] http1.1.ccontent = *( http1.1.ctext / http.quoted-pair / http1.1.comment ) -[9] http1.1.ctext = %x20-27 / %x2A-5B / %x5D-7E / %x80-FF / FWS ;; %x80-FF は [[ISO-8859-1]] で、 encoded-word が使用可能。 -[10] http.quoted-pair = "\" %x00-7F [CODE(ABNF)[quoted-pair]] に %x80-FF が使えないことに注意。 [11] [[RFC1945]] によると [[HTTP/1.0]] では [CODE(ABNF)[quoted-pair]] が使えないらしい。 でもって [CODE(ABNF)["\"]] はふつーに [CODE(ABNF)["\"]] と解釈されると。 にゃるほど、これが元凶でこーいう変な状況なのね。 -[12] http1.0.comment = "(" http1.0.ccontent ")" -[13] http1.0.ccontent = *( http1.0.ctext / http1.0.comment ) -[14] http1.0.ctext = http1.1.ctext / "\" [15] しかしそうなると、 [CODE(ABNF)[quoted-pair]] を正しく扱えない HTTP/1.0 実装は多そうだ。 (ただ扱えないだけなら[[文字化け]] (のように見える) とかの軽度の問題で済みそうだけど、 [SAMP["foo\"bar"]] みたいな値だと問題だよな。) [[#comment]] *SIP メッセージ [16] [[HTTP]] を元にしてる [[SIP]] だけど、びみょーに違う。 いやらしーのは HTTP/1.1 と同じ。(たぶん何も考えずに写したんだ。) -[17] comment = "(" *(ctext | quoted-pair | comment) ")" -[18] ctext = < any TEXT-UTF8 excluding "(" and ")"> -[19] quoted-pair = " \ " CHAR [20] >>19 [CODE(ABNF)[" \ "]] はたぶん [CODE(ABNF)["\"]] の間違いだ。そー信じたい。 -[21] sip.comment = "(" ccontent ")" -[22] sip.ccontent = *( sip.ctext / http.quoted-pair / sip.comment ) -[23] sip.ctext = %x20-27 / %x2A-5B / %x5D-7E / utf8-xtra-char / FWS [[#comment]] *RTSP メッセージ [24] HTTP 派生プロトコルの1つである [[RTSP/1.0]] ([[RFC2326]]) では [CODE(ABNF)[comment]] は使われていません。 [[#comment]] *RFC の部分の License [[RFCのライセンス]]参照。 *メモ