381521 set Vary:Accept-Encoding header for compressed content

This commit is contained in:
Greg Wilkins 2012-06-04 11:08:02 +02:00
parent 3e5eff3719
commit 66d171f7d0
2 changed files with 2 additions and 0 deletions

View File

@ -235,6 +235,7 @@ public abstract class AbstractCompressedStream extends ServletOutputStream
throw new IllegalStateException(); throw new IllegalStateException();
setHeader("Content-Encoding", _encoding); setHeader("Content-Encoding", _encoding);
setHeader("Vary","Accept-Encoding");
if (_response.containsHeader("Content-Encoding")) if (_response.containsHeader("Content-Encoding"))
{ {

View File

@ -497,6 +497,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
if (gzip) if (gzip)
{ {
response.setHeader(HttpHeaders.CONTENT_ENCODING,"gzip"); response.setHeader(HttpHeaders.CONTENT_ENCODING,"gzip");
response.setHeader(HttpHeaders.VARY,HttpHeaders.ACCEPT_ENCODING);
String mt=_servletContext.getMimeType(pathInContext); String mt=_servletContext.getMimeType(pathInContext);
if (mt!=null) if (mt!=null)
response.setContentType(mt); response.setContentType(mt);