W3C home > Mailing lists > Public > public-webapi@w3.org > May 2008

setRequestHeader / Accept (was: Re: XHR LC comments)

From: Anne van Kesteren <annevk@opera.com>
Date: Sat, 24 May 2008 13:50:24 +0200
To: "Laurens Holst" <lholst@students.cs.uu.nl>, "Julian Reschke" <julian.reschke@gmx.de>
Cc: public-webapi@w3.org
Message-ID: <op.ubnpuai264w2qv@annevk-t60.oslo.opera.com>

On Thu, 15 May 2008 20:57:44 +0200, Laurens Holst  
<lholst@students.cs.uu.nl> wrote:
> When invoking request.setRequestHeader('Accept', ''):
>
> - Firefox 3b5 removes the Accept header
> - Internet Explorer 8 (in IE7 mode) sends Accept: */*
> - Safari 3.1.1 sends Accept:
> - Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
> application/xhtml+xml, image/png, image/jpeg, image/gif,
> image/x-xbitmap, */*;q=0.1

Per the specification Safari is conformant.


> When invoking request.setRequestHeader('Accept', null):
>
> - Firefox 3b5 removes the Accept header
> - Internet Explorer 8 (in IE7 mode) sends Accept: null
> - Safari 3.1.1 sends Accept: null
> - Opera 9.24 sends Accept: text/html, application/xml;q=0.9,
> application/xhtml+xml, image/png, image/jpeg, image/gif,
> image/x-xbitmap, */*;q=0.1

Per the updated specification which uses Web IDL IE and Safari are  
conformant here. (null and undefined are simply stringified.)

(That Firefox removes the Accept header is because it treats null the same  
as the empty string.)


> I can’t believe how horribly broken this all is. No wonder few people
> depend on this header. Fortunately, as a result it can also be fixed
> without breaking much.

Yeah, if you set Accept through setRequestHeader() it should just work  
fine. If you don't the browser should provide it with a value of */*.

(The draft has not yet been updated because I'm still tweaking some bits  
with respect to Web IDL.)


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Saturday, 24 May 2008 11:50:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 24 May 2008 11:50:39 GMT