Issue #1190 new

Static files served by 'tools.staticdir' cause decompression errors in browsers when both 'tools.gzip' and 'tools.caching' are on, but only when served from the cache.

Michiel Overtoom
created an issue

I think I found a bug when both 'tools.gzip' and 'tools.caching' are on, for static files served by 'tools.staticdir'. Static content is placed uncompressed in the cache, but incorrectly marked as compressed, and the result is that only the first serving is send correctly compressed to the client. Subsequent requests cause errors in the browser.

By the way, no exceptions are thrown by CherryPy.

I have attached a small test program which demonstrates this problem. Reloading the static file in the browser should produce the problem.

Comments (3)

  1. George Weinberg

    Based on my tests, it looks like the proper information is stored in the cache and retriived by cache.get I think the problem is in the tee_ouput function in lib/, It ends with response.body = tee(response.body) but the internal function "tee" is returning None, so the response.body is set to None. replacing the line with tee(response.body) without the assignment seems to fix the problem.

  2. Log in to comment