File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,6 @@ public static void verbose(String message) {
3232 }
3333 }
3434
35- public static int ifErrorSend (int errorCode , Socket client ) {
36- if (errorCode != 0 ) {
37- HttpResponse errorResponse = new HttpResponse (errorCode );
38- errorResponse .send (client );
39- return 1 ;
40- }
41- return 0 ;
42- }
43-
4435 public static void handle (Socket client ) {
4536 int errorCode = 0 ;
4637 Socket server = null ;
@@ -56,7 +47,11 @@ public static void handle(Socket client) {
5647 BufferedReader fromClient = new BufferedReader (new InputStreamReader (client .getInputStream ()));
5748 verbose ("\n **** New Request ****" );
5849 request = new HttpRequest (fromClient );
59- verbose ("---> Request --->\n " + request .toString ()); // Debug
50+ verbose ("---> Request --->\n " + request .toString ());
51+ if (request .getError () != 0 ) {
52+ new HttpResponse (request .getError ()).send (client );
53+ return ;
54+ }
6055 } catch (IOException e ) {
6156 System .out .println ("Error reading request from client: " + e );
6257 new HttpResponse (400 ).send (client );
You can’t perform that action at this time.
0 commit comments