[html5] XHR Questions

Anne van Kesteren annevk at annevk.nl
Sat Mar 19 22:57:59 PDT 2016

On Sat, Mar 19, 2016 at 7:29 AM, Gomer Thomas
<gomer at gomert-consulting.com> wrote:
>        For some reason, which I still don't understand, this capability was taken out by the time of the August 2011 version. In that version incremental consumption was only enabled for "text" type responses, not for "document" or "any" type responses.

Yes, I took that out because of the reason I stated. It would require
allocation of a great many objects and that was not seen as desirable.
To do this efficiently you need streams. Note that responseText is not
efficient either, but we could not remove that because it was already

>        Since no one seems to know why the XMLHttpRequest() specification was changed to take away the incremental consumption capability for binary files, it seems unlikely it will be changed back any time soon, if at all (even though the current situation is a violation of the spirit of the specifications regarding support for chunked encoding in RFC 7230).

It's not. XMLHttpRequest is just an API, it doesn't have to support
all features of HTTP.

>  Therefore, it appears that a proprietary solution based on a WebSocket will need to be implemented for the next couple of years at least, until Streams are mature and well supported.

You'll need that either way, even if we changed XMLHttpRequest today,
which we won't, it wouldn't be supported for quite a while.

>        In fact, even then a proprietary solution to get Streams from a remote server to an application's browser context might be required. The Streams specification appears to assume that everything is happening locally. I guess one could put a local "Streams" wrapper around the WebSocket interface, but the advantages of that over a pure proprietary solution are not clear.

Streams is being integrated with the fetch() API, which is the now
favored way to do networking in a browser.

Hope this clears things up a bit.


More information about the Help mailing list