From fa1c1ededf03e31470194e811d0e8b45f4d8e2cd Mon Sep 17 00:00:00 2001 From: Sean Owen Date: Wed, 13 May 2015 12:14:01 +0100 Subject: [PATCH] Reintroduce basic DoS filter in web app --- .../src/main/java/com/google/zxing/web/DecodeServlet.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zxingorg/src/main/java/com/google/zxing/web/DecodeServlet.java b/zxingorg/src/main/java/com/google/zxing/web/DecodeServlet.java index 525257161..fabd413af 100644 --- a/zxingorg/src/main/java/com/google/zxing/web/DecodeServlet.java +++ b/zxingorg/src/main/java/com/google/zxing/web/DecodeServlet.java @@ -84,7 +84,7 @@ import javax.servlet.http.Part; maxRequestSize = 10_000_000, fileSizeThreshold = 1_000_000, location = "/tmp") -@WebServlet("/w/decode") +@WebServlet(value = "/w/decode", loadOnStartup = 1) public final class DecodeServlet extends HttpServlet { private static final Logger log = Logger.getLogger(DecodeServlet.class.getName()); @@ -204,13 +204,13 @@ public final class DecodeServlet extends HttpServlet { try { connection.connect(); - } catch (IOException ioe) { + } catch (IOException | IllegalArgumentException e) { // Encompasses lots of stuff, including // java.net.SocketException, java.net.UnknownHostException, // javax.net.ssl.SSLPeerUnverifiedException, // org.apache.http.NoHttpResponseException, // org.apache.http.client.ClientProtocolException, - log.info(ioe.toString()); + log.info(e.toString()); errorResponse(request, response, "badurl"); return; }