[[#comment]] * 仕様書から ** RFC 1945 (HTTP/1.0) D.2.3; RFC 2068・2616 (HTTP/1.1) 14.3 Accept-Encoding > The Accept-Encoding request-header field is similar to Accept, but restricts the [DEL[[INS[{1945,2068}]] content-coding values [INS[[INS[{2068}]] (section 14.12)]] which]] [INS[[INS[{2616}]] content-codings (section 3.5) that]] are acceptable in the response. [CODE(HTTP)[Accept-Encoding]] 応答頭欄は、 [CODE(HTTP)[[[Accept]]]] と同様のものですが、応答で受入れ可能な [[content-coding]] を制限します。 [INS[ > [INS[{2068,2616}]] - [DEL[[INS[{2068}]] [CODE(ABNF)[[DFN[Accept-Encoding]] = "Accept-Encoding" ":" #( content-coding )]]]] - [INS[[INS[{2616}]] [CODE(ABNF)[[DFN[Accept-Encoding]] = "Accept-Encoding" ":" 1#( codings [ ";" "q" "=" qvalue ] )]]]] - [INS[[INS[{2616}]] [CODE(ABNF)[[DFN[codings]] = ( content-coding | "*" )]]]] > [DEL[[INS[{2068}]] An example of its use is]] [INS[[INS[{2616}]] Examples of its use are:]] - Accept-Encoding: compress, gzip - [INS[[INS[{2616}]] Accept-Encoding:]] - [INS[[INS[{2616}]] Accept-Encoding: *]] - [INS[[INS[{2616}]] Accept-Encoding: compress;q=0.5, gzip;q=1.0]] - [INS[[INS[{2616}]] Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0]] [INS[ > [INS[{2616}]] A server tests whether a content-coding is acceptable, according to an Accept-Encoding field, using these rules: = 1. If the content-coding is one of the content-codings listed in the Accept-Encoding field, then it is acceptable, unless it is accompanied by a qvalue of 0. (As defined in section 3.9, a qvalue of 0 means "not acceptable.") = 2. The special "*" symbol in an Accept-Encoding field matches any available content-coding not explicitly listed in the header field. = 3. If multiple content-codings are acceptable, then the acceptable content-coding with the highest non-zero qvalue is preferred. = 4. The "identity" content-coding is always acceptable, unless specifically refused because the Accept-Encoding field includes "identity;q=0", or because the field includes "*;q=0" and does not explicitly include the "identity" content-coding. If the Accept-Encoding field-value is empty, then only the "identity" encoding is acceptable. サーバーは、 [CODE(HTTP)[Accept-Encoding]] 欄に従い、次の規則を使って [CODE(ABNF)[content-coding]] が受け入れ可能かを検査します: = Content-coding が [CODE(HTTP)[Accept-Encoding]] 欄に列挙された content-coding なら、その [[qvalue]] が [CODE(HTTP)[0]] でない限りは受入れ可能です。 (3.9 節で定義したように、 qvalue [CODE(HTTP)[0]] は「受入れ不能」を意味します。) = [CODE(HTTP)[Accept-Encoding]] 欄中の特殊な [CODE(HTTP)[*]] 記号は、 頭欄中に陽に列挙されていない利用可能な content-coding に一致します。 = 複数の content-coding が受入れ可能なら、最高の非零 qvalue の受入れ可能 content-coding を優先します。 = [CODE(HTTP)[[[identity]] content-coding は、 [CODE(HTTP)[Accept-Encoding]] 欄が]] [CODE(HTTP)[identity;q=0]] を含むか、 [CODE(HTTP)[*;q=0]] を含んで [CODE(HTTP)[identity]] content-coding を陽に含んでいないために特に断られていない限り、 常に受入れ可能です。 [CODE(HTTP)[Accept-Encoding]] 欄値が空の場合、 [CODE(HTTP)[identity]] 符号化だけが受入れ可能です。 > If an Accept-Encoding field is present in a request, and if the server cannot send a response which is acceptable according to the Accept-Encoding header, then the server SHOULD send an error response with the 406 (Not Acceptable) status code. [CODE(HTTP)[Accept-Encoding]] 欄が要求に示されている場合、 そしてサーバーが [CODE(HTTP)[Accept-Encoding]] 頭に従って受入れ可能な応答を送れない場合は、 サーバーは [CODE(HTTP)[[[406]]]] (受入れ不能) 状態符号で誤り応答を送る'''べきです'''。 ]INS] > If no Accept-Encoding field is present in a request, the server MAY assume that the client will accept any content coding. [INS[[INS[{2616}]] In this case, if "identity" is one of the available content-codings, then the server SHOULD use the "identity" content-coding, unless it has additional information that a different content-coding is meaningful to the client.]] [DEL[[INS[{2068}]] If an Accept-Encoding header is present, and if the server cannot send a response which is acceptable according to the Accept-Encoding header, then the server SHOULD send an error response with the 406 (Not Acceptable) status code.]] [CODE(HTTP)[Accept-Encoding]] 欄が要求中に示されていない場合、 サーバーはクライアントがどの内容符号かも受け入れると仮定しても'''構いません'''。 [INS[[INS[{2616}]] この場合、 [CODE(HTTP)[identity]] が利用可能な content-coding の1つであれば、クライアントにはこれ以外の content-coding に意味があるという追加の情報がない限り、サーバーは [CODE(HTTP)[identity]] content-coding を使用する'''べきです'''。]] [DEL[[INS[{2068}]] [CODE(HTTP)[Accept-Encoding]] 頭が示されている場合、そしてサーバーが [CODE(HTTP)[Accept-Encoding]] 頭に従って受入れ可能な応答を送れない場合は、サーバーは [CODE(HTTP)[[[406]]]] (受入れ不能) 状態符号で誤り応答を送る'''べきです'''。]] [DEL[ > [INS[{2068}]] An empty Accept-Encoding value indicates none are acceptable. 空の [CODE(HTTP)[Accept-Encoding]] 値は、どれも受け入れ可能でないことを示します。 ]DEL] [INS[ > [INS[{2616}]] Note: If the request does not include an Accept-Encoding field, and if the "identity" content-coding is unavailable, then content-codings commonly understood by HTTP/1.0 clients (i.e., "gzip" and "compress") are preferred; some older clients improperly display messages sent with other content-codings. The server might also make this decision based on information about the particular user-agent or client. > Note: Most HTTP/1.0 applications do not recognize or obey qvalues associated with content-codings. This means that qvalues will not work and are not permitted with x-gzip or x-compress. 注意 : 要求が [CODE(HTTP)[Acceot-Encoding]] 欄を含んでいない場合、 そして [CODE(HTTP)[identity]] content-coding が利用可能で無い場合、 HTTP/1.0 クライアントが広く理解可能な content-coding (すなわち [CODE(HTTP)[[[gzip]]]] 及び [CODE(HTTP)[[[compress]]]]) が優先されます。幾つかの古いクライアントは他の content-coding で送られたメッセージを不適切に表示します。サーバーは特定の利用者エージェントまたはクライアントについての情報にも基づいてこの決定を行うかもしれません。 注意 : ほとんどの HTTP/1.1 応用は content-coding に関連付けられた qvalue を認識したり従ったりしません。 これは、 qvalue が [CODE(HTTP)[[[x-gzip]] や [CODE(HTTP)[[[x-compress]]]]]] では働かず、認められないことを意味します。 ]INS] ]INS] ** RFC の部分の License [[RFCのライセンス]] * メモ - [1] 古い時代の [[HTTP]] では (他の欄同様に) [CODE(HTTP)[[[,]]]] と [CODE(HTTP)[[[;]]]] を逆に使ったりすることもありました。 - [2] というかそうしていました。 - [3] 今の時代の [[UA]] でも、知らない content-coding を使ってるとそのまま表示しちゃったりしますよね。。。 [4] [CODE(HTTP)@en[[[Accept-Encoding]]]] を受信したら[[鯖]]はそれに従うか [CODE(HTTP)@en[[[406]]]] と[['''するべきです''']]と [[RFC 2616]] にはありますが、実際の多くの [[Web頁]]ではそうはならないようです。 例えば、 [CODE(HTTP)@en[[[Accept-Encoding]]: [[*]]; [[q]]=0]] とだけあれば必ず [CODE(HTTP)@en[[[406]]]] が返されるべきですが、 実際にそうなるのは [[Apache]] で[[内容折衝]]が用いられている静的な[[文書]]などに限られます。 ([[名無しさん]] [WEAK[2007-11-23 05:49:34 +00:00]])