FIXED
Hi,
I've now changed the download function to use response.stream in order
for the Http Header 'Content-Disposition: attachment;
filename=myimg.JPG' not to be added. That didn't make a difference
except that one can now enter the image URL into the browser without
being prompted to save the file. So it's not a download function
anymore :)
Next I added these headers:
response.headers['Expires'] = 'Sun, 20 Sep 2009 12:00:00 GMT'
response.headers['Last-Modified'] = 'Mon, 10 Aug 2009 12:13:14
GMT'
response.headers['Cache-Control'] = 'max-age=3600'
But that had no effect either. Every time I revisit the page the
pictures would briefly flash (as if cached) and then start trickling
in again.
Finally this fixed it:
if request.env.http_if_modified_since:
raise HTTP(304)
HC
On Aug 11, 9:33 pm, hcvst <[email protected]> wrote:
> Hi,
>
> I am surprised I didn't find a post on slow downloads, but perhaps
> it's only so bad because my internet connection is terribly slow.
>
> def download():
> """
> allows downloading of uploaded files
> http://..../[app]/default/download/[filename]
> """
> return response.download(request,db)
>
> I am just building an auction site and have around 10 pictures on a
> page - uploaded by users. On refresh all of them reload (line by line,
> as in the old days). Can I tell the browser to cache them?
>
> Without looking at the source I tried a cache decorator (in disk-
> caching mode), assuming that it might tell the browser, but actually
> ended up having to restart apache (mod_wsgi).
>
> Regards,
> HC
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---