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

Resepct head method

parent 1333a382
......@@ -18,7 +18,7 @@
#include "http.h"
#define PORT 26887
#define PORT 26885
#define DEBUG 0
#define TRUE 1
......@@ -121,18 +121,19 @@ 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));
FILE *fp;
size_t numBytesReadFile;
fp = fopen(path, "r");
char fileBuff[1024];
if (fp) {
printf("\nGot a fp\n");
while ((numBytesReadFile = fread(fileBuff, 1023, 1, fp)) > 0) {
printf("%s", fileBuff);
write(clientfd, fileBuff, strlen(fileBuff));
if (verb == HTTP_GET) {
FILE *fp;
size_t numBytesReadFile;
fp = fopen(path, "r");
char fileBuff[1024];
if (fp) {
printf("\nGot a fp\n");
while ((numBytesReadFile = fread(fileBuff, 1023, 1, fp)) > 0) {
write(clientfd, fileBuff, strlen(fileBuff));
}
}
fclose(fp);
}
fclose(fp);
} else {
char *basicHeader = "HTTP/1.1 404 Not Found\r\n\r\n";
appendBuffer(&response, basicHeader, strlen(basicHeader));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment