#?SuikaWiki/0.9 page-icon="HTTP" [[#comment]] * 仕様書から ** RFC 2068・2616 (HTTP/1.1) 4.3 Message Body > The message-body (if any) of an HTTP message is used to carry the entity-body associated with the request or response. The message-body differs from the entity-body only when a transfer[INS[-]]coding has been applied, as indicated by the Transfer-Encoding header field (section [DEL[14.40]] [INS[14.41]]). HTTP [[メッセージ]]の [CODE(ABNF)[message-body]] は (あれば) その[[要求]]または[[応答]]に関連付けられた [CODE(ABNF)[[[entity-body]]]] を伝達するのに使います。 [CODE(ABNF)[message-body]] は、 [CODE(HTTP)[[[Transfer-Encoding]]]] 頭欄で示されたとおりの [CODE(ABNF)[transfer-coding]] ([[転送符号化]]) を適用した時だけ [CODE(ABNF)[entity-body]] と違います。 > -message-body = entity-body | > Transfer-Encoding MUST be used to indicate any transfer[INS[-]]codings applied by an application to ensure safe and proper transfer of the message. Transfer-Encoding is a property of the message, not of the entity, and thus [DEL[can]] [INS[MAY]] be added or removed by any application along the request/response chain. [INS[(However, section 3.6 places restrictions on when certain transfer-codings may be used.)]] [[応用]]がメッセージの安全で適切な転送のために適用した [CODE(ABNF)[transfer-coding]] を示すために [CODE(HTTP)[Transfer-Encoding]] を使用しなければ'''なりません'''。 [CODE(HTTP)[Transfer-Encoding]] はメッセージの特性であって、 [[実体]]の特性ではなく、従って要求・応答鎖の任意の応用が追加したり削除したりして'''構いません'''。 [INS[(しかし、3.6節である [CODE(ABNF)[transfer-coding]] をいつ使っても良いかを制限しています。)]] > The rules for when a message-body is allowed in a message differ for requests and responses. メッセージ中でいつ [CODE(ABNF)[message-body]] が認められるかの規則は要求と応答で異なります。 > The presence of a message-body in a request is signaled by the inclusion of a Content-Length or Transfer-Encoding header field in the request's message-headers. A message-body [DEL[MAY]] [INS[MUST NOT]] be included in a request [DEL[only when the request method (section 5.1.1) allows an entity-body]] [INS[if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests]]. [INS[A server SHOULD read and forward a message-body on any request; if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request]]. 要求で [CODE(ABNF)[message-body]] があることは、 要求の [CODE(ABNF)[message-headers]] 中に [CODE(HTTP)[[[Content-Length]]]] 頭欄または [CODE(ABNF)[[[Transfer-Encoding]]]] 頭欄を含めることで示します。 [CODE(ABNF)[message-body]] は、[DEL[[[要求方式]]が [CODE(ABNF)[entity-body]] を認めているときだけ]][INS[要求方式の仕様が要求で [CODE(ABNF)[entity-body]] を送ることを認めていなければ]]要求に含めて[DEL['''構いません''']][INS[は'''なりません''']]。[INS[サーバーは、任意の要求の [CODE(ABNF)[message-body]] を読み、転送する'''べきです'''。 [CODE(ABNF)[entity-body]] の意味を定義していない要求方式のときには、要求を処理するに当たって [CODE(ABNF)[message-body]] を無視する'''べきです'''。]] > For response messages, whether or not a message-body is included with a message is dependent on both the request method and the response status code (section 6.1.1). All responses to the HEAD request method MUST NOT include a message-body, even though the presence of entity-header fields might lead one to believe they do. All 1xx (informational), 204 (no content), and 304 (not modified) responses MUST NOT include a message-body. All other responses do include a message-body, although it [DEL[may]] [INS[MAY]] be of zero length. 応答メッセージでは、メッセージに [CODE(ABNF)[message-body]] を含めることができるかどうかは要求方式と応答[[状態符号]]の両方によって決まります。 [CODE(HTTP)[[[HEAD]]]] 要求方式に対するすべての要求は、 [CODE(ABNF)[entity-header]] (実体頭) 欄が示されていて [CODE(ABNF)[message-body]] が含まれていると思えるように見えたとしても、 [CODE(ABNF)[message-body]] を含めては'''なりません'''。すべての [CODE(HTTP)[[[1xx]]]] (情報提供), [CODE(HTTP)[[[204]]]] (無内容), [CODE(HTTP)[[[304]]]] (無修正) 応答は [CODE(ABNF)[message-body]] を含んでは'''なりません'''。 他のすべての応答は [CODE(ABNF)[message-body]] を含みます。 長さ零でも'''構いません'''が。 ** RFC の部分のライセンス [[RFCのライセンス]] * メモ