added forking
This commit is contained in:
20
src/utils.c
20
src/utils.c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user