On Thursday, August 15, 2013 7:44:44 AM UTC-7, Andrew Sutherland wrote: > On 08/15/2013 09:20 AM, Roger Dentz wrote: > > > I'm developing a B2G app that sends multipart/related data to a server. > > The data is an XML header (part 1) followed by a binary file wrapped in XML > > (part 2). The file can be large and needs to be sent using http chunking. > > I don't see how to do http chunking with XMLHttpRequest, and TcpSocket > > won't let you use port 80 for non-certified apps (app will be privileged, > > just not certified). Are there any other options? > > > > There is currently no way to produce data on demand for XHR from > > content-space. (Chrome code in Firefox is capable of doing it, > > however.) The good news is that XHR lets you send a Blob, and you can > > build a Blob out of multiple parts, including other Blobs that are > > disk-backed. See > > https://developer.mozilla.org/en-US/docs/Web/API/Blob#Constructor > > > > Presumably your data is already coming from disk, so this should work out. > > > > For example: > > var myAggregateBlob = new Blob([multipartRelatedStuffAndXML, myFileBlob, > > multipartRelatedPartEnd]) > > > > Andrew
However it needs to be sent chunked - http://en.wikipedia.org/wiki/Chunked_transfer_encoding The header needs to include "transfer-encoding: chunked" and each block needs to be preceded by a length field. This is a requirement of the server, whether we have all the info available on disk or not. -R. _______________________________________________ dev-webapps mailing list [email protected] https://lists.mozilla.org/listinfo/dev-webapps
