diff --git a/bin/org/eu/lumiere/Lumiere.class b/bin/org/eu/lumiere/Lumiere.class index 659cca7..fd0a09c 100644 Binary files a/bin/org/eu/lumiere/Lumiere.class and b/bin/org/eu/lumiere/Lumiere.class differ diff --git a/src/org/eu/lumiere/Lumiere.java b/src/org/eu/lumiere/Lumiere.java index 0f42dd2..989af10 100644 --- a/src/org/eu/lumiere/Lumiere.java +++ b/src/org/eu/lumiere/Lumiere.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.net.Socket; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.NoSuchElementException; import java.util.TimeZone; import org.eu.lumiere.loggers.GlobalLogger; @@ -13,6 +14,7 @@ import org.eu.lumiere.net.ServerEvents; import org.eu.lumiere.net.http.HttpRequest; import org.eu.lumiere.net.http.HttpRequestHandler; import org.eu.lumiere.net.http.HttpResponse; +import org.eu.lumiere.utils.SimpleResponse; public class Lumiere implements ServerEvents{ @@ -49,9 +51,14 @@ public class Lumiere implements ServerEvents{ SimpleDateFormat gmtDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); gmtDate.setTimeZone(TimeZone.getTimeZone("GMT")); httpH.setProperty("Date", gmtDate.format(new Date())); - - request.onRequestReceived(new HttpRequest(socket), httpH); - + + try { + request.onRequestReceived(new HttpRequest(socket), httpH); + }catch (NoSuchElementException e) { + httpH.setStatus("HTTP/1.1 400 Bad Request"); + new SimpleResponse("Bad Request", false).onRequestReceived(null, httpH); + } + try { if(socket.isConnected()) socket.close();