Skip to content

Commit a8119ba

Browse files
committed
code review
1 parent 55ea1f3 commit a8119ba

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

ProxyCache.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)