W3C home > Mailing lists > Public > public-webapi@w3.org > March 2007

Re: [XHR] Default Content-Type

From: Anne van Kesteren <annevk@opera.com>
Date: Sat, 17 Mar 2007 22:38:12 +0100
To: "Alexey Proskuryakov" <ap-carbon@rambler.ru>, public-webapi@w3.org
Message-ID: <op.tpcrpydc64w2qv@id-c0020>

On Sat, 17 Mar 2007 08:18:41 +0100, Alexey Proskuryakov  
<ap-carbon@rambler.ru> wrote:
>> Scripts should specify the Content-Type header via setRequestHeader
>> before invoking send() with an argument.
>
> Is invoking send() without an argument really a special case where  
> scripts do not need to use setRequestHeader()? I'm pretty sure that many  
> servers will look at Content-Type first, and reject a request if it's  
> incorrect, even if there is no data.

If that would be the case many requests Internet Explorer would make would  
fail. So it seems highly unlikely to me.


>> If the argument to send() is a Document and no Content-Type
>> header has been set user agents must set it to application/xml for XML
>> documents and to the most appropriate media type for other documents  
>> (using
>> intrinsic knowledge about the document).
>
> What are the examples of how this intrinsic knowledge can be used? It is  
> not clear how to achieve interoperability here without a precise list of  
> cases.

I agree, but I don't want to make the specification too limiting. One  
example would be sending an HTML document I suppose although that may just  
end up being send as XML. (As user agents appear to do now.)


> Also, what is the default Content-Type for string arguments?

Nothing. That's what Internet Explorer does.


> Firefox just defaults to "application/xml" for any data  
> <http://lxr.mozilla.org/seamonkey/source/content/base/src/nsXMLHttpRequest.cpp#1616>,  
> and so do nightly builds of WebKit.

I don't think this is the best way to do it.


http://tc.labs.opera.com/apis/XMLHttpRequest/send/ has some demonstrations  
(5-8) that I've yet to turn into real testcases.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Saturday, 17 March 2007 21:38:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:57 GMT