[9] abc ([[abc]] [aaa] [WEAK[2004-07-28 08:53:40 +00:00]]) [11] nice site! ([[norwegion cruise]] [asdasd@asdasd.com] [WEAK[2007-06-18 21:10:23 +00:00]]) [[#comment]] * 仕様書から ** RFC 1945 (HTTP/1.0) 10.4; RFC 2068 14.14; RFC 2616 14.13 (HTTP/1.1) Content-Length > The Content-Length entity-header field indicates the size of the [DEL[[INS[{1945}]] Entity-Body]] [INS[[INS[{2068,2616}]] message-body]], in decimal number of octets, sent to the recipient or, in the case of the HEAD method, the size of the [DEL[[INS[{1945}]] Entity-Body]] [INS[[INS[{2068,2616}]] entity-body]] that would have been sent had the request been a GET. [CODE(HTTP)[Content-Length]] 実体頭欄は、受信者に送られる [CODE(ABNF)[message-body]], 又は [CODE(HTTP)[[[HEAD]]]] method の場合には [CODE(HTTP)[[[GET]]]] での要求だったなら送られるであろう [CODE(ABNF)[entity-body]]]] の寸法をオクテット数の十進数表現で示します。 > - Content-Length = "Content-Length" ":" 1*DIGIT > An example is - Content-Length: 3495 > Applications [DEL[[INS[{1945}]] should]] [INS[[INS[{2068}]] SHOULD]] use this field to indicate the size of the [DEL[[INS[{1945}]] Entity-Body]] [INS[[INS[{2068,2616}]] message-body]] to be transferred, regardless of the media type of the entity. [DEL[[INS[{1945}]] A valid Content-Length field value is required on all HTTP/1.0 request messages containing an entity body.]] [INS[[INS[{2068}]] It must be possible for the recipient to reliably determine the end of HTTP/1.1 requests containing an entity-body, e.g., because the request has a valid Content-Length field, uses Transfer-Encoding: chunked or a multipart body.]] 応用は、実体の媒体型に関わらず、転送する [CODE(ABNF)[message-body]] の寸法を示すのにこの欄を用いる'''べきです'''。 [DEL[妥当な [CODE(HTTP)[Content-Length]] 欄値が、実体本体を含んでいる全ての HTTP/1.0 要求メッセージに必須です。]] [INS[受信者が [CODE(ABNF)[entity-body]] を含んだ HTTP/1.1 要求の終わりを確実に決定出来るように、例えば要求が妥当な [CODE(HTTP)[Content-Length]] 欄を持つとか、 [CODE(HTTP)[[[Transfer-Encoding]]: [[chunked]]]] を使うとか、[[複数部分実体]]であるとかでなければなりません。]] > Any Content-Length greater than or equal to zero is a valid value. Section [DEL[[INS[{1945}]] 7.2.2]] [INS[[INS[{2068}]] 4.4]] describes how to determine the length of a [DEL[[INS[{1945}]] response entity body]] [INS[[INS[{2068}]] message-body]] if a Content-Length is not given. 零以上のどんな Content-Length も妥当な値です。4.4節は Content-Length がない時に message-body の長さがどう決定されるかを説明しています。 > Note[DEL[: The [INS[{1945,2068}]]]] [INS[that the [INS[{2616}]]]] meaning of this field is significantly different from the corresponding definition in MIME, where it is an optional field used within the "message/external-body" content-type. In HTTP, it [DEL[[INS[{1945}]] should]] [INS[[INS[{2068}]] SHOULD]] be used whenever the [DEL[[INS[{1945}]] entity]] [INS[[INS[{2068}]] message]]'s length can be determined prior[INS[, unless this is prohibited by the rules in section 4.4 [INS[{2616}]]]]. (要約: [[MIME]] の似たのとは違うのねん。) ** RFC 2616 (HTTP/1.1) 4.4 Message Length [PRE[ The transfer-length of a message is the length of the message-body as it appears in the message; that is, after any transfer-codings have been applied. When a message-body is included with a message, the transfer-length of that body is determined by one of the following (in order of precedence): ]PRE] メッセージの transfer-length は message 中にある message-body の長さです。 これは、 transfer-codings が適用された後のものです。 message-body がメッセージに含まれている場合、その本文の transfer-length は次のもののいずれか一つ (優先順) で決定されます。 [PRE[ 1.Any response message which "MUST NOT" include a message-body (such as the 1xx, 204, and 304 responses and any response to a HEAD request) is always terminated by the first empty line after the header fields, regardless of the entity-header fields present in the message. ]PRE] message-body を含んでは「'''いけない'''」応答メッセージ (1xx, 204, 304 各応答と HEAD 要求の全ての応答) は常に頭欄の後の最初の 空行で終わります。メッセージに entity-header 欄があってもです。 [PRE[ 2.If a Transfer-Encoding header field (section 14.41) is present [DEL[and has any value other than "identity",]] then the transfer-length is defined by use of the "chunked" transfer-coding (section 3.6), unless the message is terminated by closing the connection. ]PRE] [CODE(HTTP)[[[Transfer-Encoding]]]] 頭欄があ[DEL[って [CODE(HTTP)[[[identity]]]] 以外の値をと]]る場合、 [CODE(ABNF)[transfer-length]] は [CODE(HTTP)[[[chunked]]]] [CODE(ABNF)[transfer-coding]] の使用により定義されます。 但しメッセージが接続を閉じることにより終わる場合を除きます。 [INS[ 注 : 削除部分は errata (>>7) による。 ]INS] [PRE[ 3.If a Content-Length header field (section 14.13) is present, its decimal value in OCTETs represents both the entity-length and the transfer-length. The Content-Length header field MUST NOT be sent if these two lengths are different (i.e., if a Transfer-Encoding header field is present). If a message is received with both a Transfer-Encoding header field and a Content-Length header field, the latter MUST be ignored. ]PRE] Content-Length 頭欄 ([[Content-Length:欄]]) がある場合、 OCTET での10進値が entity-length と transfer-length の両方を示します。 Content-Length 頭欄はこの2つの値が異なる (つまり Transfer-Encoding 頭欄がある) 時には送っては'''なりません'''。 Transfer-Encoding 頭欄と Content-Length 欄の両方を含むメッセージを 受け取った場合は、後者は無視しないと'''いけません'''。 > 4.If the message uses the media type "multipart/byteranges", and the [INS[t]]ransfer-length is not otherwise specified, then this self-[INS[d]]elimiting media type defines the transfer-length. This media type [INS[M]]UST NOT be used unless the sender knows that the recipient can [INS[p]]arse it; the presence in a request of a Range header with [INS[m]]ultiple byte-range specifiers from a 1.1 client implies that the [INS[c]]lient can parse multipart/byteranges responses. メッセージが媒体型 "multipart/byteranges" を使用している場合、 かつ [INS[t]]ransfer-length が他で指定されていない時、この自己[INS[区]]切媒体型が [CODE[transfer-length]] を定義します。 この媒体型は、受信者がこれを[INS[解]]析できると送信者が知っていない限り使っては'''[INS[い]]けません'''。 HTTP/1.1 クライアントからの[INS[複]]数の byte-range 指定がある Range 頭がある要求は、[INS[ク]]ライアントが multipart/byteranges 応答を解析できることを暗示しています。 [INS[ [7] 訳注: 原文欠落箇所は ''HTTP/1.1 Specification Errata'' [DEL[]] [INS[>7) による。 ]INS] [PRE[ When a Content-Length is given in a message where a message-body is allowed, its field value MUST exactly match the number of OCTETs in the message-body. HTTP/1.1 user agents MUST notify the user when an invalid length is received and detected. ]PRE] ** RTSP (RFC 2326) 12.14 Content-Length > This field contains the length of the content of the method (i.e. after the double CRLF following the last header). Unlike HTTP, it MUST be included in all messages that carry content beyond the header portion of the message. If it is missing, a default value of zero is assumed. It is interpreted according to [H14.14]. [5] この欄は、[RUBY[方式] [method]] の内容 (つまり、最後の頭の後の 2つの CRLF の後) の長さから成ります。 HTTP とは違って、メッセージの頭部分を超えた内容を伝える全てのメッセージはこれを含め'''なければなりません'''。 これが欠けていた場合は既定値の零とみなします。 これは [H14.14] により解釈します。 ** RFC の部分の License [[RFCのライセンス]] * メモ - [1] [WEAK[2002-11-15 (金) 18:10]] ''[[名無しさん]]'': [[HTTP]] ではなく[[電子メイル]]や[[電子ニュース]]でも使われるのがたまに見られます。古い [[MIME]] の draft に書いてあったのではないかと思いますが、確認していません。 - [2] [WEAK[2002-11-15 (金) 18:11]] ''[[名無しさん]]'': MIME 的には [[Content-Disposition]]:欄の "size" パラメーターが後に用意されました。 - [3] [WEAK[2002-11-15 (金) 18:11]] ''2'': また電子ニュースでは伝統的に [[Lines]]:欄という似たものがあります。 - [4] [WEAK[2002-11-15 (金) 18:13]] ''2'': [[CGI]] では[[メタ変数]] [[CONTENT_LENGTH]] が規定されていて、こちらは必須です。 - [6] [WEAK[2002-12-17 (火) 20:49]] ''[[名無しさん]]'': [[iモード]]に対して送るときは Content-Length: 欄は必須となります。 - [8] 関連する [[CGI]] の[[メタ変数]]として、 [CODE(CGI)[[[CONTENT_LENGTH]]]] があります。 [10] [CITE[セキュリティホール memo - 2005.07]] ([[名無しさん]])