On Thursday, August 15, 2013 1:02:11 PM UTC-7, Roger Dentz wrote:
> On Thursday, August 15, 2013 9:20:06 AM UTC-7, Andrew Sutherland wrote:
> 
> > On 08/15/2013 11:29 AM, Roger Dentz wrote:
> 
> > 
> 
> > > 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.
> 
> > 
> 
> > 
> 
> > 
> 
> > Chunked encoding doesn't seem to require any discussion between the 
> 
> > 
> 
> > server and your client, so you should be able to just pre-can all of the 
> 
> > 
> 
> > chunks.
> 
> > 
> 
> > 
> 
> > 
> 
> > Blobs know their length (.size) and can be sliced 
> 
> > 
> 
> > (https://developer.mozilla.org/en-US/docs/Web/API/Blob#slice%28%29). If 
> 
> > 
> 
> > the server is fine with a single chunk, it seems like you could add that 
> 
> > 
> 
> > boilerplate.  If the server wants to hear about things in smaller 
> 
> > 
> 
> > chunks, you can slice up the Blob to fake smaller chunks and provide the 
> 
> > 
> 
> > boilerplate for those chunks too.  Those slices will still only be 
> 
> > 
> 
> > streamed from disk as they are needed.
> 
> > 
> 
> > 
> 
> > 
> 
> > Unless XHR isn't letting you set the transfer-encoding header?
> 
> > 
> 
> > 
> 
> > 
> 
> > Andrew
> 
> 
> 
> Yeah, that's about the size of it.  It ignores setRequestHeader for 
> transfer-encoding=chunked and sets the content-length to whatever the sum of 
> all your blob parts is.
> 
> 
> 
> -R.

So I think I'll focus on TcpSocket - there were several code samples where they 
access port 80 so maybe that's a doc typo where it says apps have to be 
certified to access any port < 1024.  Seems benign enough to allow port 80 
access since that's what XHR does anyway.  Right now it doesn't work for any 
port so still need to poke around a little.

Thanks fer the advice,
-R.
_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps

Reply via email to