Console: Enable compression (ticket #2157)

This commit is contained in:
zzz
2018-03-09 19:31:15 +00:00
parent a845d4f225
commit 44c38dffad
4 changed files with 23 additions and 7 deletions

View File

@ -15,7 +15,7 @@ import net.i2p.util.Log;
import net.i2p.util.PortMapper; import net.i2p.util.PortMapper;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.servlets.gzip.GzipHandler;
/** /**
* Block certain Host headers to prevent DNS rebinding attacks. * Block certain Host headers to prevent DNS rebinding attacks.
@ -26,12 +26,13 @@ import org.eclipse.jetty.server.handler.HandlerWrapper;
* *
* @since 0.9.32 * @since 0.9.32
*/ */
public class HostCheckHandler extends HandlerWrapper public class HostCheckHandler extends GzipHandler
{ {
private final I2PAppContext _context; private final I2PAppContext _context;
private final PortMapper _portMapper; private final PortMapper _portMapper;
private final Set<String> _listenHosts; private final Set<String> _listenHosts;
private static final String PROP_REDIRECT = "routerconsole.redirectToHTTPS"; private static final String PROP_REDIRECT = "routerconsole.redirectToHTTPS";
private static final String PROP_GZIP = "routerconsole.enableCompression";
/** /**
* MUST call setListenHosts() afterwards. * MUST call setListenHosts() afterwards.
@ -41,6 +42,11 @@ public class HostCheckHandler extends HandlerWrapper
_context = ctx; _context = ctx;
_portMapper = ctx.portMapper(); _portMapper = ctx.portMapper();
_listenHosts = new HashSet<String>(8); _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");
}
} }
/** /**

View File

@ -368,15 +368,19 @@ public class RouterConsoleRunner implements RouterApp {
*<pre> *<pre>
* Server * Server
* HandlerCollection * HandlerCollection
* HostCheckHandler * HostCheckHandler (extends GzipHandler)
* ContextHandlerCollection * ContextHandlerCollection
* WebAppContext (i.e. ContextHandler) * LocaleWebAppHandler (routerconsole)
* SessionHandler * SessionHandler
* SecurityHandler * SecurityHandler
* ServletHandler * ServletHandler
* servlets... * servlets...
* WebAppContext * WebAppContext (i2psnark)
* ... * WebAppContext (i2ptunnel)
* WebAppContext (imagegen)
* WebAppContext (susidns)
* WebAppContext (susimail)
* WebAppContext (for each plugin with a .war)
* DefaultHandler * DefaultHandler
* RequestLogHandler (opt) * RequestLogHandler (opt)
*</pre> *</pre>

View File

@ -1,3 +1,6 @@
2018-03-09 zzz
* Console: Enable compression (ticket #2157)
2018-03-08 zzz 2018-03-08 zzz
* Crypto: Generate non-CA cert for family * Crypto: Generate non-CA cert for family
* Router: * Router:
@ -6,6 +9,9 @@
- Don't select IPv6-only routers for IBGW or OBEP - Don't select IPv6-only routers for IBGW or OBEP
- Don't try to build tunnel if adjacent peers aren't compatible - Don't try to build tunnel if adjacent peers aren't compatible
- Remove ancient version check in peer selectors - Remove ancient version check in peer selectors
- Check for transport compatibility before direct store of RI;
send through tunnel if incompatible
- Fix repeated store of RI when IPv6-only
2018-03-07 zzz 2018-03-07 zzz
* Router: * Router:

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 13; public final static long BUILD = 14;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";