title: HTTP: What is the preferred Accept-Encoding for "gzip,deflate"?
body: <p>This question is regarding the order of precedence for the media-types of the HTTP Header "Accept-Encoding" when <strong>all are of equal weight</strong> and has been prompted by <a href="http://www.singular.co.nz/2008/07/finding-preferred-accept-encoding-header-in-csharp/#comment-1708101319" rel="noreferrer">this comment</a> on my blog.</p>
  
  <h3>Background:</h3>
  
  <p>The Accept-Encoding header takes a comma separated list of <em>media-types</em> the browser can accept e.g. gzip,deflate</p>
  
  <p>A <em>quality factor</em> can also be specified to give preference to other media-types e.g. in the case of "gzip;q=.8,deflate", deflate is preferred - but is <em>not relevant to this question</em>. NB: A type with a "q=0" means "not acceptable".</p>
  
  <p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="noreferrer">RFC2616</a> also states that the "most specific reference" for the media-type definition should be weighted first. i.e. "text/html;level=1" should be used over "text/html" - this is not relevant to the question also.</p>
  
  <h3>Question:</h3>
  
  <p>In the following case, which media-type has precedence?</p>
  
  <pre><code>Accept-Encoding: gzip,deflate
  </code></pre>
  
  <p>Both types have an equivalent <em>quality factor of 1</em>, and both types are "acceptable" to the browser - so either one could be used. I'd always assumed that the first type entered should be "preferred", but there doesn't seem to be a specific example or preference for this particular case in the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="noreferrer">RFC</a>.</p>