[whatwg] First or last Content-Type header?

Geoffrey Sneddon foolistbar at googlemail.com
Sun May 31 04:55:21 PDT 2009


On 30 May 2009, at 23:20, Adam Barth wrote:

> In editing the content sniffing Internet Draft today, I noticed the
> draft uses the *first* Content-Type header.  Internet Explorer uses
> the first Content-Type header, but Firefox and Google Chrome use the
> last Content-Type header.  (I don't recall off-hand which Safari or
> Opera use.)  Because the sniffing algorithm is more similar to the
> algorithms used by Firefox and Google Chrome, I've changed this aspect
> to match them as well.

Firefox, Safari and Opera use the last header in all cases where there  
is a header that is only expected to appear once (i.e., doesn't take a  
#rule as a value), and have a list of all headers that they expect to  
appear only once. IE use the first header in all cases where it  
doesn't expect the header to appear more than once (i.e., a header  
like "X-Foobar" appearing twice returns the value of the first one). I  
don't know about Chrome, because that only appeared after I last did  
any work on HTTP parsing (but it normally follows Firefox from the  
small amount of experimentation I've done with it since). I, on the  
whole, would be tempted to take the first header, and use a list of  
headers that you expect to only appear once (i.e., a mix of behaviours).


--
Geoffrey Sneddon
<http://gsnedders.com/>



More information about the whatwg mailing list