Encapsulates logic related to various gzip compression schemes and their rules
as they apply to different browsers.
Determines if gzip compression is appropriate/possible based on the User Agent and
other limiting factors. IE versions < 6.1 are known to not work with gzip compression reliably.
request The current web request to check the headers of.
- True, if this request can be served in gzip format. False otherwise.
if (encoding == null || encoding.indexOf("gzip") < 0)
int ieIndex = (userAgent != null) ? userAgent.indexOf("MSIE") : -1;
Based on the given type of content, determines if compression is appropriate. The biggest
thing it does is make sure that image content isn't compressed as that kind of content
is already compressed fairly well.
- True if compression is appropriate for the content specified, false otherwise.
|| contentType.indexOf("html") > -1
|| contentType.indexOf("text") > -1;