Google AppEngine Blobstore: how to ensure browser shows progress and total size of a download?
Asked Answered
B

2

8

When I serve a download from the blobstore, I notice that the browser does NOT show the total size and time remaining, the download goes on until it's complete, but the browser seem to have no idea of how the total size which is expected.

Note that:

  • This only happens in the production server, at appspot.com. In the development environment (localhost) things work as expected, the browser shows the total size, percent done, and the approx time remaining...

  • I tried to set the header 'Content-Length' to the blob size, no luck.

  • When analyzing the headers of a downloaded blob, the Content-Length header is absent (even if I wrote it before using "send_blob"). The headers are like this:

HTTP/1.0 200 OK =>
Cache-Control => no-cache
Content-Disposition => attachment; filename="Setup.exe"
Expires => Fri, 01 Jan 1990 00:00:00 GMT
Content-Type => application/octet-stream
Date => Thu, 31 Mar 2011 20:19:52 GMT
Server => Google Frontend

Anybody has any idea on how to make the browser show the total size, percent downloaded, and estimated remaining time?

Boatyard answered 31/3, 2011 at 20:23 Comment(0)
H
8

You can't do anything about it, except starring this issue.

Here are the problems:

  1. The BlobInfo class does not have a file size attribute.

  2. The send_blob function, having a BlobInfo as parameter, can't set a Content-Length HTTP Response header.

  3. The Content-Length Header can't be modified by the application on GAE.

Horeb answered 31/3, 2011 at 22:31 Comment(2)
Thanks. I have starred the issue too. I am only left to wonder why this actually works in the Development Environment and not at appspot.com... hopefully they'll get around to fix it eventually.Boatyard
@systempuntoout: The BlobInfo class does not have a file size attribute? AFAIK, Blobinfo has a size attribute. size - The size of the Blobstore value, as a number of bytes. An integer. Check here: code.google.com/appengine/docs/python/blobstore/…Originative
A
0

If you use the Blobstore API with Google Cloud Storage, you can just serve via GCS directly using Blob.generate_signed_url, which does add a Content-Length header.

Argosy answered 28/10, 2016 at 13:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.