[web2py] Re: Caching downloads

2010-06-30 Thread Chris S
Got it. That was driving me nuts. By default the static folder is handled by App.yaml on GAE. But no expiration date was set in the default file provided with web2py. Adding an expiration date causes static files to start properly caching again. I also tested removing the "static" section of ap

[web2py] Re: Caching downloads

2010-06-30 Thread Chris S
Got it. That was driving me nuts. By default the static folder is handled by App.yaml on GAE. But no expiration date was set in the default file provided with web2py. Adding an expiration date causes static files to start properly caching again. I also tested removing the "static" section of ap

[web2py] Re: Caching downloads

2010-06-30 Thread mdipierro
If I understand you talk about normal static files. That is done in gluon/main.py static_file = parse_url(request, environ) if static_file: if request.env.get('query_string', '')[:10] == 'attachment': response.headers['Content-Dispositio

[web2py] Re: Caching downloads

2010-06-30 Thread Chris S
I'll take a look and see what I can do. Can you point me to where this is happening? I see a streamer.py but no where does it set Cache-Control = no-cache. Where is that decision being made? I'm assuming in the same gluon module I'll find the logic behind the auto-stream of /static/filename? On

[web2py] Re: Caching downloads

2010-06-30 Thread mdipierro
I may have sent the wrong link. There are two issues: 1) we tried to set a cache for static files in the past and we run into problems with ssl and ie. This was discussed at lenght in an old thread but I cannot find it now. 2) It is unclear whether serving static content should cache. In a product

[web2py] Re: Caching downloads

2010-06-30 Thread Chris S
I'm not sure I understand the comment. Following the link it says that Microsoft file formats can not be opened if the cache-control is set to no-cache. What I'm seeing is cache-control is *always* set to no-cache when I expected it to allow caching of files in /static. It seems that with the abo

[web2py] Re: Caching downloads

2010-06-30 Thread mdipierro
Unfortunately settings cache-control breaks IE with SSL http://support.microsoft.com/kb/316431 On 30 Giu, 13:57, Chris S wrote: > I've had this bookmarked and have been looking over it recently.  I > added a c_download (cached download) function as described above to > allow local caching of fil

[web2py] Re: Caching downloads

2010-06-30 Thread Chris S
I've had this bookmarked and have been looking over it recently. I added a c_download (cached download) function as described above to allow local caching of files. The above code did not get me there though I ended up using: def c_download(): controller=request.vars.c file=request.vars.

[web2py] Re: Caching downloads

2010-05-06 Thread mdipierro
Can you provide an example of code that causes cache failure? Remember that you cannot @cache def download because of range requests. On May 6, 2:49 am, Iceberg wrote: > It seems Mariano's story has a happy ending. Congratulations. But on a > second thought, can anyone explain why "if you quickly

[web2py] Re: Caching downloads

2010-05-06 Thread Iceberg
It seems Mariano's story has a happy ending. Congratulations. But on a second thought, can anyone explain why "if you quickly reload pages, they fail" in the very first caching-download version? Caching download can improve speed, can with a side effect of bypassing priviledge check, but no matter

[web2py] Re: Caching downloads

2010-05-04 Thread mdipierro
+1 On May 4, 10:39 pm, Mariano Reingart wrote: > I'm using Apache & mod_wsgi > > I'm looking at the other thread that massimo suggests changes to > apache.conf, but after using fast_download (changing headers and using > stream) it runs really quickly! > > (I know, serving through apache would be

Re: [web2py] Re: Caching downloads

2010-05-04 Thread Mariano Reingart
I'm using Apache & mod_wsgi I'm looking at the other thread that massimo suggests changes to apache.conf, but after using fast_download (changing headers and using stream) it runs really quickly! (I know, serving through apache would be even faster, but in this case I prefer portability and a eas

Re: [web2py] Re: Caching downloads

2010-05-04 Thread Thadeus Burgess
What webserver are you using? You could use the X-Sendfile header if it supports it. This way the webserver will send cache headers and web2py does not have to serve them. -- Thadeus On Tue, May 4, 2010 at 9:25 PM, mdipierro wrote: > response.stream (which you use) handles if-modified-since

[web2py] Re: Caching downloads

2010-05-04 Thread mdipierro
response.stream (which you use) handles if-modified-since and range requests automatically. On May 4, 9:04 pm, Mariano Reingart wrote: > I thought so, > > I had to modify mydownload so browsers do client-side caching, > speeding up the web-page load: > > def fast_download(): >     # very basic se

Re: [web2py] Re: Caching downloads

2010-05-04 Thread Mariano Reingart
I thought so, I had to modify mydownload so browsers do client-side caching, speeding up the web-page load: def fast_download(): # very basic security: if not request.args(0).startswith("sponsor.logo"): return download() # remove/add headers that prevent/favors caching del

[web2py] Re: Caching downloads

2010-05-04 Thread mdipierro
caching downloads does not make sense. This is because the role of download is to check permissions to download a file (if they are set). if you cache it then you do not check. If you do not need to check do not use download. Use def mydownload(): return response.stream(open(os.path.join(requ