A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
1 <?xml version="1.0" encoding="iso-8859-1" ?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 <title>Compressing HTTP contents using Content-Encoding</title> 7 <meta name="author" content="Michael Schröpl" /> 8 <meta name="description" content="A short description of the procedure for serving compressed page content in HTTP" /> 9 <meta name="keywords" content="Apache, HTTP, encoding, gzip, compression" /> 10 <style type="text/css"> 11 body{font-family:sans-serif;margin:0px 30px 0px 30px;} 12 h1{font-size:22px;margin-top:20px;} 13 h2{font-size:18px;margin-top:14px;} 14 small{font-size:80%;} 15 td{vertical-align:top;} 16 tt{font-weight:bold;} 17 code,tt{font-family:"Courier New",monospace;} 18 h1,h2{margin-bottom:1px;} 19 p,td{margin-top:3px;margin-bottom:3px;} 20 p,ul,ol,li{font-size:17px;line-height:22px;} 21 ul,ol,li{margin-top:0px;margin-bottom:0px;} 22 img{border-width:0;} 23 24 #nav{position:absolute;top:30px;left:0px;font-size:14px;width:170px;font-weight:bold;margin:2px 2px 2px 30px;} 25 #nav[id]{position:fixed;} 26 #nav img{margin:5px;} 27 #nav p, #nav a:hover, #nav a{display:block;padding:3px;margin:2px;width:150px;font-size:15px;line-height:18px;} 28 #content{position:absolute;left:220px;right:30px;} 29 #mail{text-align:right;} 30 #icon{width:190px;float:left;} 31 #mail,#icon{margin-top:30px;} 32 33 @media screen { 34 body{color:#000;background-color:#f8ebd9;} 35 h1{color:#666;} 36 h2{color:#840;} 37 code{color:#333;} 38 em{color:#900;} 39 tt{color:#909;} 40 h1,h2,code,em,tt{background-color:inherit;} 41 .new13192a{color:#inherit;background-color:#ffd;} 42 .new13261a{color:#inherit;background-color:#eff;} 43 .bugfix{color:#fff;background-color:#f00;font-weight:bold;padding:0px 4px;} 44 #nav a{color:#530;background-color:transparent;} 45 #nav a{text-decoration:none;} 46 #nav p, #nav a:hover{color:#000;background-color:#fff;} 47 #nav p {border:1px #660 solid;} 48 #nav a {border:1px #666 dotted;} 49 } 50 51 @media print { 52 #icon,#nav{display:none;} 53 #content{position:absolute;left:0px;right:0px;} 54 } 55 </style> 56 </head> 57 58 <body> 59 60 <div id="nav"> 61 62 <img src="mod_gzip_logo.gif" height="47" width="102" alt="mod_gzip logo" /> 63 64 65 <a title="mod_gzip - what's that, anyway?" href="index.htm">mod_gzip</a> 66 67 68 69 <p>Content-Encoding</p> 70 71 72 73 <a title="Which browsers can handle 'Content-Encoding: gzip'?" href="browser.htm">Browsers</a> 74 75 76 77 <a title="How do Firewalls handle 'Content-Encoding:'?" href="firewalls.htm">Firewalls</a> 78 79 80 81 <a title="An example configuration for mod_gzip" href="config.htm">Configuration</a> 82 83 84 85 <a title="Complete description of mod_gzip status codes" href="status.htm">Status Codes</a> 86 87 88 89 <a title="Possible enhancements in future versions of mod_gzip" href="enhancements.htm">Enhancements</a> 90 91 92 93 <a title="Caching of negotiated HTTP responses" href="cache.htm">Caching</a> 94 95 96 97 <a title="Version history and change log for mod_gzip" href="versions.htm">Versions</a> 98 99 100 101 <a title="Other ressources about mod_gzip" href="links.htm">Links</a> 102 103 104 </div> 105 106 <div id="content"> 107 108 <h1>Compressing HTTP contents using Content-Encoding</h1> 109 110 <h2><a id="communication"></a>Communication in HTTP</h2> 111 <p>For the transmission of web contents between server and client the <strong>Hypertext Transfer Protocol</strong> <small>(<a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html"><img class="linkicon" height="15" width="16" alt="arrow" title="external" src="extern.gif" />HTTP</a>)</small> is being used.</p> 112 <p>The communication works the following way:</p> 113 <ol> 114 <li>The client is sending a request to the server. This requests mainly consists of <strong>HTTP headers</strong> that describe which data the client wants to receive.<br /> 115 To some degree the client is able to <em>directly influence</em> the data content <small>(like specifying the URL of the requested page)</small>; other parts of its request supply the server with additional information about which type of data the client would <em>prefer to receive</em>, if the server has to offer several data variations.</li> 116 <li>The server evaluates all available information to decide which data with what kind of attributes were requested and subsequently attempts to serve these data in a form most suitable to the client's request.<br /> 117 This data packet again contains HTTP headers but mainly <strong>data</strong> - which nevertheless can only be partially interpretable without consideration of the HTTP headers.</li> 118 </ol> 119 <p>The second aspect of determining the desired content is named <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html#sec12"><img class="linkicon" height="15" width="16" alt="arrow" title="external" src="extern.gif" />Content Negotiation</a> in its general form. Delivering compressed page content in the form described here is based on this general principle as well.</p> 120 121 <h2><a id="encoding"></a>Encodings in HTTP</h2> 122 <p>HTTP 1.1 defines in <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5"><img class="linkicon" height="15" width="16" alt="arrow" title="external" src="extern.gif" />chapter 3.5.</a> so-called <strong>content encodings</strong> that should be supported be each browser compliant to this standard.</p> 123 <p>For communication between server and client these encodings have the following meaning:</p> 124 <ol> 125 <li>This client <em>may</em> specify a liste of accepted content encodings in the HTTP header <code>Accept-Encoding:</code>. The special encoding <code>identity</code> <small>(describing an encoding that doesn't change the content)</small> will be used implicitly as default value.</li> 126 <li>The server <em>should</em> deliver the content of the requested document using an encoding accepted by this client.<br /> 127 If the server isn't able to do so the it <em>should</em> reject the request with the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7"><img class="linkicon" height="15" width="16" alt="arrow" title="external" src="extern.gif" />status code <code>406 Not Acceptable</code></a>; nevertheless it <em>may</em> deliver contents not acceptable for this client according to its request <small>(and whose processing might cause unsolvable problems for the Client)</small>.<br /> 128 The Apache webserver uses a defensive strategy in this respect: If it cannot serve a page according to the client's requests but has several other variants on offer it dynamically generates a HTML document containing a short description of the situation and links to all documents in question. <small>(This is the case as well if this very document is requested by a browser that accepts none of the languages <code>de</code> und <code>en</code> supported by myself according to its current configuration; I have deliberately not defined a default value to make this problem aware to foreign language readers of these pages.)</small></li> 129 </ol> 130 <p>If a server serves a file containing an encoding to a client not capable of handling it then this clients might not be able to handle it correctly.</p> 131 132 <div id="icon"> 133 <a href="http://validator.w3.org/check/referer"><img alt="" title="valid XHTML 1.1" height="31" width="88" src="valid-xhtml11.png" /></a><a href="http://jigsaw.w3.org/css-validator/check/referer"><img alt="" title="valid CSS" height="31" width="88" src="valid-css.png" /></a> 134 </div> 135 136 137 <p id="mail">(<a href="mailto:michael.schroepl@gmx.de?subject=mod_gzip">Michael Schröpl</a>, 2002-07-12)</p> 138 139 </div> 140 141 </body> 142 </html>