added forking

This commit is contained in:
Pin
2022-02-21 20:59:44 -05:00
parent 2f73f776f6
commit 16801086ff
6 changed files with 213 additions and 64 deletions

View File

@@ -1,5 +1,12 @@
#include <stdio.h>
#include <time.h>
#include <string.h>
#define NUM_SUPPORTED_VERSIONS 2
static char supportedHTTPVersions[NUM_SUPPORTED_VERSIONS][16] = {
"HTTP/1.1",
"HTTP/1.0"
};
int PrintLog(unsigned char *message) {
time_t UTCTime;
@@ -11,3 +18,16 @@ int PrintLog(unsigned char *message) {
(now->tm_year + 1900), now->tm_hour, now->tm_min, now->tm_sec, message);
return 0;
}
int checkHTTPVersion(char *version) {
int supported = -1; // Default fail state
char testVer[16];
strcpy(testVer, version);
//testVer[strlen(version) - 1] = '\0'; // Removing
for (int i = 0; i < NUM_SUPPORTED_VERSIONS; i++) {
if (!strcmp(testVer, supportedHTTPVersions[i])) {
supported = 0;
}
}
return supported;
}