Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set blob download sizes in GAE apps now that the Content-Length header is disallowed?

After the AppEngine API update that came out a few weeks ago, the wonderful "Disallowed HTTP Response Headers" section appeared in the Python Response class documentation here, which explains that the listed headers cannot be set for security purposes.

That is all well and good except that now all of my blob downloads have unknown lengths, causing all major browsers show unknown length progress indicators! Suffice it to say that users (and myself) find this quite annoying for large downloads, as there is no way to guess how long the download will take, or how far along they may be. I fixed this before by setting the Content-Length header based on the blob's info records in the datastore, but now that that is disallowed, is there another way to accomplish this? Any ideas much appreciated!

like image 316
Collin Arnold Avatar asked Dec 24 '10 03:12

Collin Arnold


1 Answers

Are your files transferred with

Transfer-Encoding: Chunked

Then it is possible over HTTP to send these files without the Content-Length: header. See the HTTP/1.1 RFC on Chunked Transfer Coding. I guess you should be able to define your own handler for the methods such as get etc, and create yourself the HTTP responses using webapp.WSGIApplication. OTOH, Adrian Holovaty never received an answer to this same question.

like image 175
karlcow Avatar answered Oct 13 '22 00:10

karlcow