javascript - Why does Internet Explorer not send HTTP post body on Ajax call after failure? -


we able reliably recreate following scenario:

  1. create small html page makes ajax requests server (using http post)
  2. disconnect network , reconnect
  3. monitor packets ie generates after failure

after failed network connection, ie makes next ajax request sends http header (not body) when doing http post. causes sorts of problems on server partial request. google issue bing , you'll find lots of people complaining "random server errors" using ajax or unexplained ajax failures.

we know ie (unlike other browsers) sends http post 2 tcp/ip packets. header , body sent separately. in case directly after failure, ie sends header.

so question - why behave way? seems wrong based on http spec , other browsers don't behave way. bug? surely creates havoc in serious ajax based web application.

reference information:

there similar problem, triggered http keep-alive timeouts shorter 1 minute , documented here:

http://us.generation-nt.com/xmlhttprequest-post-sometimes-fails-when-server-using-keep-aliv-help-188813541.html

http://support.microsoft.com/default.aspx?kbid=831167

here before , after failure packet captures:

notice how http header , payload sent http://img827.imageshack.us/i/beforee.png/

after failure, notice how header sent. ie never sends payload , server responds timeout. http://img203.imageshack.us/i/retryt.png/

there not seem clear answer question, provide empirical data substitute , provide ways work around it. maybe ms insider 1 day shed light on this...

  1. if http keep-alive disabled on server, issue goes away. in other words, http 1.1 server respond every ajax request connection: close line in response. keeps ie happy causes every ajax request open new connection. can have significant performance impact, on high latency networks.

  2. the issue triggered if ajax requests made in rapid succession. example, make ajax requests every 100ms , network status changes, error easy reproduce. although applications not make such requests, might have couple of server calls happening right after each other lead problem. less chatty keeps ie happy.

  3. it happens without ntlm authentication.

  4. it happens when http keep-alive timeout on server shorter default (which defaults 60 seconds on windows). details provided in link in question.

  5. it not happen chrome or firefox. ff sends 1 packet seems avoid issue altogether.

  6. it happens in ie 6, 7, 8. not reproduce ie 9 beta.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -