Re: handling of POST in XMLHTTPRequest.

* Anne van Kesteren wrote:
>>> It seems implementations should not set a Content-Type header
>>> if the author didn't specify one for non-Documents, and for
>>> Documents it should be the type of the Document, and if that
>>> type is not known, and the Document supports the XML feature,
>>> an XML media type. Does that make sense to you?
>
>How do you determine the type of the Document? You mean HTMLDocument  
>results in application/xhtml+xml or text/html? It makes sense for at least  
>XML documents given your test results. Can you still overwrite it though?

Implementations are assumed to have intrinsic knowledge about the type,
they get it e.g. from the Content-Type header in a HTTP response, or
from the operating system for local files. If no type is known, this is
handled above for documents that support the XML feature. It is unclear
to me whether we want to handle edge cases in version 1.0 [1]. It is
also not necessary to have such defaults so long as serialization is
always to XML [2].

The HTMLDocument case is for text/html; I would expect that you can set
it to something else, yes.

[1] For example, as I pointed out in the discussion whether we want to
    make */xml and */*+xml the only permissable types for .responseXML,
    implementations might convert non-XML documents into XML documents,
    say you have <object data="example.txt" /> object.contentDocument
    would be a HTMLDocument which you can xhr.send(...) in Firefox. It
    would not surprise me if GET'ing a text/plain document would set
    .responseXML to what object.contentDocument would be set to. 

[2] Some might argue that's a bug and would expect that their HTML4
    content is serialized in accord with the rules for HTML4, then
    you would expect the type to be text/html. For the case in [1]
    you might also expect that text/plain serialization would be used,
    and so the Content-Type be set to text/plain. That's then non-
    trivial if the text/plain-as-HTMLDocument got modified...
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Sunday, 7 May 2006 02:46:15 UTC