add note on Etags differing between compressed and uncompressed versions of the same resource [thanks mnot]

This commit is contained in:
Mark Pilgrim
2009-11-07 00:32:45 +01:00
parent f02cd3e406
commit 480e142d86
+4
View File
@@ -161,6 +161,10 @@ Cache-Control: max-age=31536000, public</samp></pre>
<p><abbr>HTTP</abbr> supports <a href=http://www.iana.org/assignments/http-parameters>several compression algorithms</a>. The two most common types are <a href=http://www.ietf.org/rfc/rfc1952.txt>gzip</a> and <a href=http://www.ietf.org/rfc/rfc1951.txt>deflate</a>. When you request a resource over <abbr>HTTP</abbr>, you can ask the server to send it in compressed format. You include an <code>Accept-encoding</code> header in your request that lists which compression algorithms you support. If the server supports any of the same algorithms, it will send you back compressed data (with a <code>Content-encoding</code> header that tells you which algorithm it used). Then it&#8217;s up to you to decompress the data.
<blockquote class=note>
<p><span class=u>&#x261E;</span>Important tip for server-side developers: make sure that the compressed version of a resource has a different <a href=#etags>Etag</a> than the uncompressed version. Otherwise, caching proxies will get confused and may serve the compressed version to clients that can&#8217;t handle it. Read the discussion of <a href=https://issues.apache.org/bugzilla/show_bug.cgi?id=39727>Apache bug 39727</a> for more details on this subtle issue.
</blockquote>
<p>Python&#8217;s <abbr>HTTP</abbr> libraries do not support compression, but <code>httplib2</code> does.
<h3 id=redirects>Redirects</h3>