Console: Change sendError() to setStatus() for 3xx responses

to avoid unnecessary output
This commit is contained in:
zzz
2018-02-20 19:45:49 +00:00
parent 86b3b13d6f
commit 33ea4cf571
5 changed files with 8 additions and 5 deletions

View File

@ -1368,7 +1368,8 @@ public class I2PSnarkServlet extends BasicServlet {
if (p.length() > 0) if (p.length() > 0)
buf.append(p.replace("&", "&")); // no you don't html escape the redirect header buf.append(p.replace("&", "&")); // no you don't html escape the redirect header
resp.setHeader("Location", buf.toString()); resp.setHeader("Location", buf.toString());
resp.sendError(303, "Received"); resp.setStatus(303);
resp.flushBuffer();
} }
/** @since 0.9 */ /** @since 0.9 */

View File

@ -63,7 +63,8 @@ public class CodedIconRendererServlet extends HttpServlet {
I2PAppContext.getGlobalContext().logManager().getLog(getClass()).warn("Error writing binary image data for plugin", e); I2PAppContext.getGlobalContext().logManager().getLog(getClass()).warn("Error writing binary image data for plugin", e);
} }
} else { } else {
srs.sendError(304, "Not Modified"); srs.setStatus(304);
srs.flushBuffer();
} }
} else { } else {
//Binary data is not present but must be substituted by file on disk //Binary data is not present but must be substituted by file on disk

View File

@ -31,7 +31,7 @@ if (c != null &&
long iflast = request.getDateHeader("If-Modified-Since"); long iflast = request.getDateHeader("If-Modified-Since");
// iflast is -1 if not present; round down file time // iflast is -1 if not present; round down file time
if (iflast >= ((lastmod / 1000) * 1000)) { if (iflast >= ((lastmod / 1000) * 1000)) {
response.sendError(304, "Not Modified"); response.setStatus(304);
return; return;
} }
response.setDateHeader("Last-Modified", lastmod); response.setDateHeader("Last-Modified", lastmod);

View File

@ -52,7 +52,7 @@ if (lastmod > 0) {
long iflast = request.getDateHeader("If-Modified-Since"); long iflast = request.getDateHeader("If-Modified-Since");
// iflast is -1 if not present; round down file time // iflast is -1 if not present; round down file time
if (iflast >= ((lastmod / 1000) * 1000)) { if (iflast >= ((lastmod / 1000) * 1000)) {
response.sendError(304, "Not Modified"); response.setStatus(304);
return; return;
} }
response.setDateHeader("Last-Modified", lastmod); response.setDateHeader("Last-Modified", lastmod);

View File

@ -2287,7 +2287,8 @@ public class WebMail extends HttpServlet
if (q != null && q.length() > 0) if (q != null && q.length() > 0)
buf.append(q.replace("&", "&")); // no you don't html escape the redirect header buf.append(q.replace("&", "&")); // no you don't html escape the redirect header
resp.setHeader("Location", buf.toString()); resp.setHeader("Location", buf.toString());
resp.sendError(303, "Received"); resp.setStatus(303);
resp.flushBuffer();
Debug.debug(Debug.DEBUG, "P-R-G to " + q); Debug.debug(Debug.DEBUG, "P-R-G to " + q);
} }