codefrau / SqueakJS

A Squeak Smalltalk VM in Javascript
https://squeak.js.org
MIT License
371 stars 76 forks source link

SocketPlugin: support incremental downloads #64

Closed codefrau closed 8 years ago

codefrau commented 8 years ago

For now we download the whole file first before passing it on to the image. We should start delivering data as soon as it arrives. This would allow the image to display proper progress, and potentially reduce memory consumption.

Since we're dealing with binary data we might have to use the fetch api, which isn't widely supported yet. So this needs to be optional.

fniephaus commented 8 years ago

I like the idea. And you're right, we'd need to use a different API, probably fetch API. I'll have a look...

fniephaus commented 8 years ago

curl -i https://crossorigin.me/http://source.squeak.org:80/squeak45/\?C\=M\;O\=D gives the following headers:

HTTP/1.1 200 OK
Date: Mon, 27 Jun 2016 14:30:47 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=dcb07c6644ffe9fc44609dc1587d0cb441467037846; expires=Tue, 27-Jun-17 14:30:46 GMT; path=/; domain=.crossorigin.me; HttpOnly
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: false
Access-Control-Allow-Headers: Content-Type
Expires: Tue, 28 Jun 2016 14:30:46 GMT
Server: cloudflare-nginx
CF-RAY: 2b99994d47812d47-TXL

We can only access Content-Type during streaming results, so I'm afraid we wouldn't be able to use crossorigin.me :S

codefrau commented 8 years ago

What would we need? We can ask Connor to let more headers through.

fniephaus commented 8 years ago

At least Content-Length, so we know how much there will be before we have ready everything