working on adding different types of requests
This commit is contained in:
@@ -25,12 +25,29 @@ void handleClient(int sock) {
|
||||
continue;
|
||||
}
|
||||
|
||||
HttpRequestHeader rh;
|
||||
char packetBuilder[HTTP_RECIVE_PACKET_SIZE] = "";
|
||||
|
||||
int sizeOfPacket = recv(sock, packetBuilder, HTTP_RECIVE_PACKET_SIZE, 0);
|
||||
|
||||
char* packetBuffer = malloc(sizeOfPacket);
|
||||
|
||||
while ((sizeOfPacket = recv(sock, packetBuilder, HTTP_RECIVE_PACKET_SIZE, 0)) > 0) {
|
||||
strncat(packetBuffer, packetBuilder, sizeOfPacket);
|
||||
}
|
||||
|
||||
|
||||
HttpRequestHeaderFromS(&rh, packetBuffer);
|
||||
|
||||
free(packetBuffer);
|
||||
|
||||
FILE* file = fopen("./web/index.html", "r");
|
||||
if (file == NULL) {
|
||||
perror("that file dose not exists");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
char* fileBuffer;
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
|
||||
Reference in New Issue
Block a user