XmlHttpRequest doesn't like no-entity responses

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

XmlHttpRequest doesn't like no-entity responses

Rob Heittman
I've attached a test case that illustrates an unpleasant behavior
between XmlHttpRequest and Restlet success responses with no entities.
 (We use Jetty connector here as usual.)  The server behavior differs
between Restlet 1.0 and 1.1 in how the no-entity responses are sent.

In Firefox 3 and Internet Explorer (possibly others) XmlHttpRequest
gets indigestion and emits a cryptic "no element found" error when
doing a GET or POST to this kind of resource.  This error is difficult
to catch, as it seems to happen outside caller code, after the initial
asynchronous call returns and before the callback fires.  Depending on
the browser environment, the result is somewhere between noisy and
catastrophic -- an embedded IE inside a SWT browser component on
Windows will lock up permanently trying to report the error.

There's a simple server-side workaround: DON'T send no-entity success responses.

But, seems like Restlet could do something about this ... either (a)
maybe we're not quite right with how we're handling no-entity success,
or (b) we could warn on the server side that sending a 200 with no
entity may have deleterious consequences.

Ideas or recommendations, anybody?

---------- Forwarded message ----------
From: Adam Schwartz <[hidden email]>
Date: Fri, Nov 7, 2008 at 1:42 PM
Subject: no element found test case
To: Rob Heittman <[hidden email]>

Just need the SimpleRestlet attached at "/postTest" and the
sampleLoginPage.html will hit it on a submit.  The first, then every
other time the Restlet gets a request, it will send back a Success and
voila, the error.

SimpleRestlet.java (644 bytes) Download Attachment
sampleLoginPage.html (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XmlHttpRequest doesn't like no-entity responses

StephanKoo
Hi Rob,
> (b) we could warn on the server side that sending a 200 with no
> entity may have deleterious consequences.
If I remember right, there is a message in the log, if there is no entity.

best regards
   Stephan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XmlHttpRequest doesn't like no-entity responses

Rob Heittman
Hmm.  Thought my logging was pretty verbose ... better double check.

On Fri, Nov 7, 2008 at 3:50 PM, Stephan Koops <[hidden email]> wrote:
> If I remember right, there is a message in the log, if there is no entity.
>
> best regards
>  Stephan
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: XmlHttpRequest doesn't like no-entity responses

jlouvel
Administrator

Hi all,

Looking at the code, our tests and log messages weren't covering this case.
I have added the necessary changes in SVN trunk. Now a WARNING message is
logged, for example:

WARNING: A response with a 200 (Ok) status should have an entity. Make sure
that resource "http://localhost:9876/" returns one or sets the status to 204
(No content).

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

-----Message d'origine-----
De : Rob Heittman [mailto:[hidden email]]
Envoyé : vendredi 7 novembre 2008 22:38
À : [hidden email]
Objet : Re: XmlHttpRequest doesn't like no-entity responses

Hmm.  Thought my logging was pretty verbose ... better double check.

On Fri, Nov 7, 2008 at 3:50 PM, Stephan Koops <[hidden email]> wrote:
> If I remember right, there is a message in the log, if there is no entity.
>
> best regards
>  Stephan
>

Loading...