[ htmlunit-Bugs-1209682 ] XMLHttpRequest is too strict about content type

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ htmlunit-Bugs-1209682 ] XMLHttpRequest is too strict about content type

SourceForge.net
Bugs item #1209682, was opened at 2005-05-27 10:15
Message generated for change (Settings changed) made by mguillem
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1209682&group_id=47038

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: 1.6
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Steven Grimm (koreth)
>Assigned to: Marc Guillemot (mguillem)
Summary: XMLHttpRequest is too strict about content type

Initial Comment:
XMLHttpRequest.jsxFunction_send() fetches the remote
page and throws an exception if the content type is not
text/xml. But it is perfectly legal to fetch a non-XML
document with XMLHttpRequest -- the "XML" in its name
was an unfortunate choice by Microsoft. For example,
some sites use XMLHttpRequest to fetch a text/html
fragment which is then assigned (via
XMLHttpRequest.getText) to the innerHTML of some page
element.

The code should allow any content type to be fetched,
though arguably jsxGet_responseXML() should only work
if the content type was text/xml.

----------------------------------------------------------------------

>Comment By: Marc Guillemot (mguillem)
Date: 2005-10-12 14:58

Message:
Logged In: YES
user_id=402164

Now fixed in CVS.

In a first time htmlunit works like Firefox returning null
for responseXML if the response is not recognized as an xml
document

----------------------------------------------------------------------

Comment By: Steven Grimm (koreth)
Date: 2005-06-22 17:46

Message:
Logged In: YES
user_id=59197

The browser leaves the content alone (responseText is just
"<b>text</b>").

----------------------------------------------------------------------

Comment By: Daniel Gredler (sdanig)
Date: 2005-06-09 01:37

Message:
Logged In: YES
user_id=1109422

koreth: when sending a response back to the browser with
content-type "text/html", does the browser try to fix up the
returned HTML? So for example if the XMLHttpRequest object
returns "<b>text</b>" with content-type "text/html", does
the browser try to turn it into
"<html><body><b>text</b></body></html>"? Or does it treat it
like XML and just leave it alone? Thanks!

----------------------------------------------------------------------

Comment By: Steven Grimm (koreth)
Date: 2005-05-27 20:51

Message:
Logged In: YES
user_id=59197

Just ran a test to answer that question. On Mozilla,
responseXML is null when the content type is text/plain. On
IE, it appears to be an ActiveX XML object whose "xml"
property is an empty string. In both cases responseText is
the same.

----------------------------------------------------------------------

Comment By: Daniel Gredler (sdanig)
Date: 2005-05-27 17:59

Message:
Logged In: YES
user_id=1109422

Question for koreth: Do you know what XMLHttpRequest returns
in responseXML when the content type is not text/xml? Is it
the same in both IE and  Gecko browsers?

----------------------------------------------------------------------

Comment By: Daniel Gredler (sdanig)
Date: 2005-05-27 17:44

Message:
Logged In: YES
user_id=1109422

This is a valid concern. From the Apple developer site:

Note: It is essential that the data returned from the server
be sent with a Content-Type set to text/xml. Content that is
sent as text/plain or text/html is accepted by the instance
of the request object however it will only be available for
use via the responseText property.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1209682&group_id=47038


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop