From 9903a5eaec8e7814a960b1aea4f0246785d3f8c2 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Sun, 6 Dec 2020 17:57:41 -0600 Subject: I AM A MORON --- P4/util.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'P4') diff --git a/P4/util.c b/P4/util.c index 67e8a9b..c710af9 100644 --- a/P4/util.c +++ b/P4/util.c @@ -100,19 +100,23 @@ int get_request(int fd, char *filename) { read(fd, buffer, 2048); printf("%s\n", buffer); - if(sscanf(buffer, "%s %s %s", get, filename, http) < 2) { // Read HTTP Get request and parse + if(sscanf(buffer, "%s %s %s", get, filename, http) < 2) { // Read HTTP Get request and parse + close(fd); return -1; } else if (strcmp(get, "GET")) { + close(fd); printf("Not a GET\n"); return -2; } else if (strlen(filename) > 1023) { + close(fd); printf("Not sure but bad\n"); return -3; } for (int i=0; i