Closed codefrau closed 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...
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
What would we need? We can ask Connor to let more headers through.
At least Content-Length
, so we know how much there will be before we have ready everything
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.