Compare Revisions
Content-Encoding
Revision 936807:
Revision 936807 by teoli on
Revision 1088717:
Revision 1088717 by fscholz on
- Title:
- Content-Encoding
- Content-Encoding
- Slug:
- Web/HTTP/Headers/Content-Encoding
- Web/HTTP/Headers/Content-Encoding
- Tags:
- HTTP Headers Reference
- "HTTP" "Headers" "Reference"
- Comment:
- update
- Content:
-
Revision 936807 Revision 1088717 n n 7 <div> 8 {{HTTPSidebar}} 9 </div> n 8 The <strong><code>Content-Encoding</code></strong> header i n 11 The <strong><code>Content-Encoding</code></strong> header i > ndicates which algorithm is been used for this message. > ndicates which algorithm is used for the message. n 10 <p> n 13 <table class="properties"> 11 Valid values for the <code>Content-Encoding</code> header i > nclude: 12 </p> 13 <table align="left" class="standard-table"> n 16 <th> n 16 <th scope="row"> 17 Value 17 Header type n 19 <th> n 19 <td> 20 Meaning 20 {{Glossary("Response header")}} 21 </td> 22 </tr> 23 <tr> 24 <th scope="row"> 25 {{Glossary("Forbidden header name")}} n n 27 <td> 28 no 29 </td> 30 </tr> 31 </tbody> 32 </table> 33 <h2 id="Syntax"> 34 Syntax 35 </h2> 36 <pre class="syntaxbox"> 37 Content-Encoding: gzip 38 Content-Encoding: compress 39 Content-Encoding: deflate 40 Content-Encoding: identity 41 Content-Encoding: br 42 </pre> 43 <h2 id="Directives"> 44 Directives 45 </h2> 46 <dl> 47 <dt> 48 <code>gzip</code> 49 </dt> 50 <dd> 51 A format using the <a class="external" href="http://en.wi > kipedia.org/wiki/LZ77_and_LZ78#LZ77">Lempel-Ziv coding</a> (LZ77) > , with a 32-bit CRC. This is originally the format of the UNIX <e > m>gzip</em> program. The HTTP/1.1 standard also recommends that t > he servers supporting this content-encoding should recognize <cod > e>x-gzip</code> as an alias, for compatibility purposes. 52 </dd> 53 <dt> 54 <code>compress</code> 55 </dt> 56 <dd> 57 A format using the <a class="external" href="http://en.wi > kipedia.org/wiki/LZW">Lempel-Ziv-Welch</a> (LZW) algorithm. The v > alue name was taken from the UNIX <em>compress</em> program, whic > h implemented this algorithm.<br> 58 Like the compress program, which has disappeared from mos > t UNIX distributions, this content-encoding is used by almost no > browsers today, partly because of a patent issue (which expired i > n 2003). 59 </dd> 60 <dt> 61 <code>deflate</code> 62 </dt> 63 <dd> 64 Using the <a class="external" href="http://en.wikipedia.o > rg/wiki/Zlib">zlib</a> structure (defined in <a class="external" > href="http://tools.ietf.org/html/rfc1950">RFC 1950</a>), with the > <a class="external" href="http://en.wikipedia.org/wiki/DEFLATE"> > <em>deflate</em></a> compression algorithm (defined in <a class=" > external" href="http://tools.ietf.org/html/rfc1952">RFC 1951</a>) > . 65 </dd> 66 <dt> 67 <code>identity</code> 68 </dt> 69 <dd> 70 Indicates the identity function (i.e. no compression, nor > modification). This token, except if explicitly specified, is al > ways deemed acceptable. 71 </dd> 72 <dt> 73 br 74 </dt> 75 <dd> 76 A format using the <a href="https://en.wikipedia.org/wiki > /Brotli">Brotli</a> algorithm 77 </dd> 78 </dl> 79 <h2 id="Examples"> 80 Examples 81 </h2> 82 <h3 id="Preventing_caching"> 83 Compressing with gzip 84 </h3> 85 <pre> 86 Content-Encoding: gzip 87 </pre> 88 <h2 id="Specifications"> 89 Specifications 90 </h2> 91 <table class="standard-table"> 92 <tbody> 93 <tr> 94 <th scope="col"> 95 Specification 22 <th> 96 </th> 23 Standard 97 <th scope="col"> 98 Title n 28 <code>gzip</code> n 103 {{RFC("7231", "Content-Encoding", "3.1.2.2")}} n 31 <p> n 106 Hypertext Transfer Protocol (HTTP/1.1): Semantics and > Content 32 A format using the <a class="external" href="http:/ > /en.wikipedia.org/wiki/LZ77_and_LZ78#LZ77" title="http://en.wikip > edia.org/wiki/LZ77_and_LZ78#LZ77">Lempel-Ziv coding</a> (LZ77), w > ith a 32-bit CRC. This is originally the format of the UNIX <em>g > zip</em> program. The HTTP/1.1 standard also recommends that the > servers supporting this content-encoding should recognize <code>x > -gzip</code> as an alias, for compatibility purposes. 33 </p> 34 </td> 35 <td> 36 <a class="external" href="http://tools.ietf.org/html/ > rfc1952" title="http://tools.ietf.org/html/rfc1952">RFC 1952</a> 37 </td> 38 </tr> 39 <tr> 40 <td> 41 <code>compress</code> 42 </td> 43 <td> 44 A format using the <a class="external" href="http://e > n.wikipedia.org/wiki/LZW" title="http://en.wikipedia.org/wiki/LZW > ">Lempel-Ziv-Welch</a> (LZW) algorithm. The value name was taken > from the UNIX <em>compress</em> program, which implemented this a > lgorithm.<br> 45 Like the compress program, which has disappeared from > most UNIX distributions, this content-encoding is used by almost > no browsers today, partly because of a patent issue (which expir > ed in 2003). 46 </td> 47 <td> 48 HTTP/1.1 49 </td> 50 </tr> 51 <tr> 52 <td> 53 <code>deflate</code> 54 </td> 55 <td> 56 Using the <a class="external" href="http://en.wikiped > ia.org/wiki/Zlib" title="http://en.wikipedia.org/wiki/Zlib">zlib< > /a> structure (defined in <a class="external" href="http://tools. > ietf.org/html/rfc1950" title="http://tools.ietf.org/html/rfc1950" > >RFC 1950</a>), with the <a class="external" href="http://en.wiki > pedia.org/wiki/DEFLATE" title="http://en.wikipedia.org/wiki/DEFLA > TE"><em>deflate</em></a> compression algorithm (defined in <a cla > ss="external" href="http://tools.ietf.org/html/rfc1952" title="ht > tp://tools.ietf.org/html/rfc1952">RFC 1951</a>). 57 </td> 58 <td> 59 <a class="external" href="http://tools.ietf.org/html/ > rfc1950" title="http://tools.ietf.org/html/rfc1950">RFC 1950</a> > and <a class="external" href="http://tools.ietf.org/html/rfc1951" > title="http://tools.ietf.org/html/rfc1951">RFC 1951</a> 60 </td> 61 </tr> 62 <tr> 63 <td> 64 <code>identity</code> 65 </td> 66 <td> 67 Indicates the identity function (i.e. no compression, > nor modification). This token, except if explicitly specified, i > s always deemed acceptable. 68 </td> 69 <td> 70 HTTP/1.1 71 </td> 72 </tr> 73 <tr> 74 <td> 75 <code>br</code> 76 </td> 77 <td> 78 A format using the <a href="https://en.wikipedia.org/ > wiki/Brotli">Brotli</a> algorithm 79 </td> 80 <td> 81 <em>Experimental</em> n n 111 <h2 id="Browser_compatibility"> 112 Browser compatibility 113 </h2> 114 <p class="hidden"> 115 To contribute to this compatibility data, please write a pu > ll request against this file: <a href="https://github.com/mdn/bro > wser-compat-data/blob/master/http/headers.json">https://github.co > m/mdn/browser-compat-data/blob/master/http/headers.json</a>. 116 </p> n 87 n 118 {{Compat}} t t 120 <h2 id="See_also"> 121 See also 122 </h2> 123 <ul> 124 <li>{{HTTPHeader("Accept-Encoding")}} 125 </li> 126 <li>{{HTTPHeader("Transfer-Encoding")}} 127 </li> 128 </ul>