Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2177

When caching (1st request), we're always serving the gzip'd content, even if the client does not accept gzip encoding

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.6.2, 3.6.3
    • 3.6
    • cache
    • None

      Currently (i.e in trunk, since cache has been rewritten, not in 3.5.x), when the cache policy determines the entry needs to be cached, the cache filter always serves the gzipped content (assuming the gzip filter is enabled), even if the client does not accept gzip encoding (even the gzip filter is enabled, of course).

      The GZipFilter should ideally stay client-agnostic: as per its javadoc, the cache filter can then assume that whatever it will cache can be gzipped, and should be unzipped if needed. If we changed this, the cache filter could not assume anything about it, and the CachePolicy would therefore need to be aware of gzipping.

      One relatively easy fix would be to do like the ehcache web filters do: defer the writing of the response and only write it once it's been cached: instead of, as we currently do, let the normal filter chain write it and then cache the results, we could run along the filter chain until we get a CachedEntry and then write it out just like when the cache policy says we should useCache.

      This might have performance or memory usage impacts, but probably nothing more than we using the cache for other requests? We'd missing the streaming that a normal filter could do, but that is already the case when serving cached elements afaik ...

        Acceptance criteria

              had Jan Haderka
              gjoseph Magnolia International
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD