From 2b88c3ace2fe3395b5fdc20d29c2c3f762023121 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 10 Dec 2020 11:03:43 -0600 Subject: add temporary header print --- P4/util.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/P4/util.c b/P4/util.c index 3967767..07a18ef 100644 --- a/P4/util.c +++ b/P4/util.c @@ -110,6 +110,7 @@ int get_request(int fd, char *filename) { char get[100], http[100]; recv(fd, buffer, 2048, 0); + //--ERROR HANDLING-- if(sscanf(buffer, "%s %s %s", get, filename, http) < 2) { // Read HTTP Get request and parse if (close(fd) == -1) { perror("Socket close error"); @@ -117,7 +118,9 @@ int get_request(int fd, char *filename) { } return -1; } - else if (strcmp(get, "GET")) { + //Print header + printf("%s %s %s\n", get, filename, http); + if (strcmp(get, "GET")) { if (close(fd) == -1) { perror("Socket close error"); return -15; @@ -125,7 +128,7 @@ int get_request(int fd, char *filename) { printf("Not a GET\n"); return -2; } - else if (strlen(filename) > 1023) { + if (strlen(filename) > 1023) { if (close(fd) == -1) { perror("Socket close error"); return -15; @@ -133,6 +136,7 @@ int get_request(int fd, char *filename) { printf("Not sure but bad\n"); return -3; } + //--END ERROR HANDLING-- for (int i=0; i