Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XMLHTTP and POST and keepalive timeouts

From: "Clive George" <clive@------.-----.--.-->
To: NULL
Date: 2/2/2007 9:50:00 PM

First question - is this the right place to discuss use of the MS XMLHTTP 
control? (I've seen some, but am not sure :-) ). If not, any pointers to a 
better place would be appreciated, and my apologies for disturbing you all.

Now my actual question :

We're getting problems with XMLHTTP not sending POST bodies after a 
keepalive timeout. What happens is this:

Client sends request. Connection/Socket stays open as per normal HTTP 
keepalive.

10 seconds later, the server says "That's it" and terminates the 
connection - well, sends a FIN packet.
At the same time, the client sends a HTTP POST request. With a slow enough 
link (100ms latency?), it's possible for these to cross.
Obviously the server can't actually respond to this request, because it's 
said it's shutting that connection. So it accepts all the data, and chucks 
it away.
The XMLHTTP control can cope with this - it knows it has to reissue the 
request on a new connection. Unfortunately if it's a POST request, it 
appears that it only sends the message header, not the body. Which is 
obviously wrong!

What ends up happening is the server sits there waiting for the message 
body, and after a suitable timeout gives up and returns HTTP 400 - invalid 
request.

So:

Is this a known problem?
Has anybody seen it before?
Any good ideas on how to avoid it? (current plan is to simply issue a GET if 
the time since the last request was about 10 seconds - the GET will either 
force the new connection or keep the old one alive).

Oh yes - this is using the XMLHTTP which you get with IE 6, on either Win2K 
or WinXP. Code is running in javascript on a normal html page. Server is 
apache, but I don't think that's relevant. Code is this simple:

 var httpObj = new ActiveXObject('Microsoft.XMLHTTP');
 httpObj.open( "POST", url, false );
 httpObj.setRequestHeader( "Content-Type", "text/plain" );
 httpObj.send( postData );

cheers,
clive 



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent