Commit 34e6f589 authored by Matthew Burket's avatar Matthew Burket
Browse files

Resepct head method

parent 1333a382
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include "http.h"


#define PORT 26887
#define PORT 26885
#define DEBUG 0
#define TRUE 1

@@ -121,6 +121,7 @@ int handle_client(int clientfd) {
            char *basicHeader = "HTTP/1.1 200 OK\r\n\r\n";
            appendBuffer(&response, basicHeader, strlen(basicHeader));
            write(clientfd, response.array, strlen(response.array));
            if (verb == HTTP_GET) {
                FILE *fp;
                size_t numBytesReadFile;
                fp = fopen(path, "r");
@@ -128,11 +129,11 @@ int handle_client(int clientfd) {
                if (fp) {
                    printf("\nGot a fp\n");
                    while ((numBytesReadFile = fread(fileBuff, 1023, 1, fp)) > 0) {
                    printf("%s", fileBuff);
                        write(clientfd, fileBuff, strlen(fileBuff));
                    }
                }
                fclose(fp);
            }
        } else {
            char *basicHeader = "HTTP/1.1 404 Not Found\r\n\r\n";
            appendBuffer(&response, basicHeader, strlen(basicHeader));