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

Re: [XMLHttpRequest] SENT state (readState = 2)

From: Stewart Brodie <stewart.brodie@antplc.com>
Date: Tue, 29 May 2007 16:14:14 +0100
To: public-webapi@w3.org
Message-ID: <f57aff4e18cc91152a9b6c980f10eb87d4f2219b@localhost>

"Anne van Kesteren" <annevk@opera.com> wrote:

> 
> Hi,
> 
> I made http://tc.labs.opera.com/apis/XMLHttpRequest/send/010.htm which  
> shows that Opera switches to readyState = 2 when transmitting something  
> large over the wire where Internet Explorer and Firefox (haven't tested  
> Safari) stay in readyState = 1 until the whole transaction is over. This  
> seems to indicate that readyState = 2 is pretty much useless and just  
> becomes a required state to visit before going to state 3. I will update  
> the specification soonish to reflect this unless implementors (or someone 

> who can convince implementors) want to do it differently.

What happens if you write a CGI script at the server that deliberately waits
a bit between receiving the request and sending the response?  Do IE & FF
switch to state 2 at *that* point?  (i.e. indicating that it's finished
sending the request but it hasn't received the response headers back yet)

I prefer Opera's behaviour, FWIW.  I don't like the idea that if you have
scripting that is checking up on the state of the XHR object, then it will
find that the readyState is still OPEN when actually you've already invoked
the send() method.

The problem is that an additional state is probably needed ("SENDING") that
covers the period of time during which the client is transmitting the
request between OPEN and SENT.  You already know that I strongly disagree
with the spurious readystatechange events when the ready state hasn't
changed.  I wonder if this is what those spurious events are actually for -
to cover up the lack of a separate state between OPEN and SENT?


-- 
Stewart Brodie
Software Engineer
ANT Software Limited
Received on Tuesday, 29 May 2007 15:14:34 GMT

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