forked from I2P_Developers/i2p.i2p
Console: Fix gzip enable logic
Don't compress js Set charset for war resources
This commit is contained in:
@ -377,8 +377,16 @@ class BasicServlet extends HttpServlet
|
||||
protected void writeHeaders(HttpServletResponse response,HttpContent content,long count)
|
||||
throws IOException
|
||||
{
|
||||
if (content.getContentType()!=null && response.getContentType()==null)
|
||||
response.setContentType(content.getContentType());
|
||||
String rtype = response.getContentType();
|
||||
String ctype = content.getContentType();
|
||||
if (rtype != null) {
|
||||
if (rtype.equals("application/javascript"))
|
||||
response.setCharacterEncoding("ISO-8859-1");
|
||||
} else if (ctype != null) {
|
||||
response.setContentType(ctype);
|
||||
if (ctype.equals("application/javascript"))
|
||||
response.setCharacterEncoding("ISO-8859-1");
|
||||
}
|
||||
response.setHeader("X-Content-Type-Options", "nosniff");
|
||||
long lml = content.getLastModified();
|
||||
if (lml > 0)
|
||||
|
@ -43,9 +43,18 @@ public class HostCheckHandler extends GzipHandler
|
||||
_portMapper = ctx.portMapper();
|
||||
_listenHosts = new HashSet<String>(8);
|
||||
setMinGzipSize(64*1024);
|
||||
if (!_context.getBooleanPropertyDefaultTrue(PROP_GZIP)) {
|
||||
addIncludedMimeTypes("application/x-javascript", "application/xhtml+xml", "application/xml",
|
||||
"image/svg+xml", "text/css", "text/html", "text/plain");
|
||||
if (_context.getBooleanPropertyDefaultTrue(PROP_GZIP)) {
|
||||
addIncludedMimeTypes(
|
||||
// our js is very small
|
||||
//"application/javascript", "application/x-javascript",
|
||||
"application/xhtml+xml", "application/xml",
|
||||
"image/svg+xml", "text/css", "text/html", "text/plain"
|
||||
);
|
||||
} else {
|
||||
// poorly documented, but we must put something in,
|
||||
// if empty all are matched,
|
||||
// see IncludeExcludeSet
|
||||
addIncludedMimeTypes("xyzzy");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,9 @@ public class LocaleWebAppHandler extends HandlerWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pathInContext.startsWith("/js/")) {
|
||||
// war internal
|
||||
httpResponse.setCharacterEncoding("ISO-8859-1");
|
||||
}
|
||||
//System.err.println("New path: " + newPath);
|
||||
super.handle(newPath, baseRequest, httpRequest, httpResponse);
|
||||
|
Reference in New Issue
Block a user