forked from I2P_Developers/i2p.i2p
* i2psnark:
- Don't send HTML-only headers for icons - Catch IllegalStateException for icons
This commit is contained in:
@ -282,7 +282,12 @@ class BasicServlet extends HttpServlet
|
||||
{
|
||||
if (content.getLastModified()/1000 <= ifmsl/1000)
|
||||
{
|
||||
response.reset();
|
||||
try {
|
||||
response.reset();
|
||||
} catch (IllegalStateException ise) {
|
||||
// committed
|
||||
return true;
|
||||
}
|
||||
response.setStatus(304);
|
||||
response.flushBuffer();
|
||||
return false;
|
||||
|
@ -172,10 +172,19 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
// _log.debug("Service " + req.getMethod() + " \"" + req.getContextPath() + "\" \"" + req.getServletPath() + "\" \"" + req.getPathInfo() + '"');
|
||||
// since we are not overriding handle*(), do this here
|
||||
String method = req.getMethod();
|
||||
_themePath = "/themes/snark/" + _manager.getTheme() + '/';
|
||||
_imgPath = _themePath + "images/";
|
||||
// this is the part after /i2psnark
|
||||
String path = req.getServletPath();
|
||||
|
||||
// in-war icons etc.
|
||||
if (path != null && path.startsWith(WARBASE)) {
|
||||
if (method.equals("GET") || method.equals("HEAD"))
|
||||
super.doGet(req, resp);
|
||||
else // no POST either
|
||||
resp.sendError(405);
|
||||
}
|
||||
|
||||
_themePath = "/themes/snark/" + _manager.getTheme() + '/';
|
||||
_imgPath = _themePath + "images/";
|
||||
resp.setHeader("X-Frame-Options", "SAMEORIGIN");
|
||||
resp.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'");
|
||||
resp.setHeader("X-XSS-Protection", "1; mode=block");
|
||||
@ -209,14 +218,6 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
return;
|
||||
}
|
||||
|
||||
// in-war icons etc.
|
||||
if (path != null && path.startsWith(WARBASE)) {
|
||||
if (method.equals("GET") || method.equals("HEAD"))
|
||||
super.doGet(req, resp);
|
||||
else // no POST either
|
||||
resp.sendError(405);
|
||||
}
|
||||
|
||||
boolean isConfigure = "/configure".equals(path);
|
||||
// index.jsp doesn't work, it is grabbed by the war handler before here
|
||||
if (!(path == null || path.equals("/") || path.equals("/index.jsp") ||
|
||||
|
Reference in New Issue
Block a user