>I vaguely remember there being some issue with older versions of Firefox
>that this solved, but don't quote me on that.

Oddly enough, Ajaxian just had reference to a blog entry that talks about
Prototype's fix for this:

/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
if (this.transport.overrideMimeType &&
    (navigator.userAgent.match(/Gecko/(d{4})/) ||
     [0,2005])[1] <2005)
      headers['Connection'] = 'close';

As you can see, they only do the "Connection: close" header if you're
running a Gecko version in a certain year. I'd imagine they're doing this to
fix other issues--such as the issue Jim is pointing out.

While I know that generally Browser sniffing is frowned upon, I can see why
they're doing it in this case--because there doesn't appear to be any kind
of DOM sniffing trick you can use. We could do:

// Make sure the browser sends the right content length
if ( xml.overrideMimeType && !document.all )
                        xml.setRequestHeader("Connection", "close");

That might fix the problem, but I wonder if sending the "Connection: close"
string causes issues in other browsers outside of IE.

-Dan

Reply via email to