Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #378 (defect)

Opened 3 years ago

Last modified 3 years ago

gzipfilter needs to set a Vary: Accept-Encoding header

Status: closed (fixed)

Reported by: lukem Assigned to: rdelon
Priority: normal Milestone:
Component: CherryPy code Keywords:
Cc:

Otherwise, caches may incorrectly serve gzipped entities to user-agents that don't support gzip encoding!

See apache mod_deflate documentation: http://httpd.apache.org/docs/2.1/mod/mod_deflate.html#proxies

A more detailed discussion is at: http://www.port80software.com/200ok/archive/2005/01/21/272.aspx

Change History

10/29/05 21:43:13: Modified by lukem

Here is a diff to cherrypy/lib/filters/gzipfiler.py (ver 2.1.0) that adds the missing header.

52,57c52,66
<         if (ct in cherrypy.config.get('gzipFilter.mimeTypeList', ['text/html'])
<             and ('gzip' in ae)):
<             cherrypy.response.headerMap['Content-Encoding'] = 'gzip'
<             # Return a generator that compresses the page
<             level = cherrypy.config.get('gzipFilter.compresslevel', 9)
<             cherrypy.response.body = self.zip_body(cherrypy.response.body, level)
---
>         if ct in cherrypy.config.get('gzipFilter.mimeTypeList', ['text/html']):
>             # Set Vary: Accept-Encoding
>             varies = []
>             for x in cherrypy.response.headerMap.get('Vary', '').split(','):
>                 if x.strip():
>                     varies.append(x.strip())
>             if 'Accept-Encoding' not in varies:
>                 varies.append('Accept-Encoding')
>             cherrypy.response.headerMap['Vary'] =  ', '.join(varies)
>
>             if 'gzip' in ae:
>                 cherrypy.response.headerMap['Content-Encoding'] = 'gzip'
>                 # Return a generator that compresses the page
>                 level = cherrypy.config.get('gzipFilter.compresslevel', 9)
>                 cherrypy.response.body = self.zip_body(cherrypy.response.body, level)

11/01/05 15:06:03: Modified by fumanchu

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [776].

Hosted by WebFaction

Log in as guest/cpguest to create tickets