|
Lines 1-5
Link Here
|
| 1 |
--- sources/main.c.orig Mon Aug 30 13:19:03 2004 |
1 |
--- sources/main.c.orig Fri Feb 11 14:25:20 2005 |
| 2 |
+++ sources/main.c Wed Sep 15 15:03:04 2004 |
2 |
+++ sources/main.c Fri Apr 22 17:47:18 2005 |
| 3 |
@@ -23,6 +23,7 @@ |
3 |
@@ -23,6 +23,7 @@ |
| 4 |
char defaultFileName[MAX_PATH_LEN+1]; |
4 |
char defaultFileName[MAX_PATH_LEN+1]; |
| 5 |
char logFileName[MAX_PATH_LEN+1]; |
5 |
char logFileName[MAX_PATH_LEN+1]; |
|
Lines 8-14
Link Here
|
| 8 |
char cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */ |
8 |
char cgiRoot[MAX_PATH_LEN+1]; /* root for CGI scripts exec */ |
| 9 |
struct timeval sockTimeVal; |
9 |
struct timeval sockTimeVal; |
| 10 |
mimeData *mimeArray; /* here we will hold all MIME data, inited once, never to be changed */ |
10 |
mimeData *mimeArray; /* here we will hold all MIME data, inited once, never to be changed */ |
| 11 |
@@ -322,10 +323,13 @@ |
11 |
@@ -314,10 +315,13 @@ |
| 12 |
reqStruct->keepAlive = YES; |
12 |
reqStruct->keepAlive = YES; |
| 13 |
else if (!strncmp(reqArray[1], "Connection: Keep-Alive", strlen("Connection: keep-alive"))) |
13 |
else if (!strncmp(reqArray[1], "Connection: Keep-Alive", strlen("Connection: keep-alive"))) |
| 14 |
reqStruct->keepAlive = YES; |
14 |
reqStruct->keepAlive = YES; |
|
Lines 23-29
Link Here
|
| 23 |
while (i < readLines) |
23 |
while (i < readLines) |
| 24 |
{ |
24 |
{ |
| 25 |
if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:"))) |
25 |
if (!strncmp(reqArray[i], "User-Agent:", strlen("User-Agent:"))) |
| 26 |
@@ -340,6 +344,20 @@ |
26 |
@@ -332,6 +336,20 @@ |
| 27 |
#ifdef PRINTF_DEBUG |
27 |
#ifdef PRINTF_DEBUG |
| 28 |
printf("content length %ld\n", reqStruct->contentLength); |
28 |
printf("content length %ld\n", reqStruct->contentLength); |
| 29 |
#endif |
29 |
#endif |
|
Lines 44-50
Link Here
|
| 44 |
} |
44 |
} |
| 45 |
i++; |
45 |
i++; |
| 46 |
} |
46 |
} |
| 47 |
@@ -437,18 +455,39 @@ |
47 |
@@ -431,18 +449,39 @@ |
| 48 |
/* we append the default file name */ |
48 |
/* we append the default file name */ |
| 49 |
strcat(completeFilePath, defaultFileName); |
49 |
strcat(completeFilePath, defaultFileName); |
| 50 |
analyzeExtension(mimeType, completeFilePath); |
50 |
analyzeExtension(mimeType, completeFilePath); |
|
Lines 87-93
Link Here
|
| 87 |
} |
87 |
} |
| 88 |
} |
88 |
} |
| 89 |
} else if (!strcmp(req.method, "HEAD")) |
89 |
} else if (!strcmp(req.method, "HEAD")) |
| 90 |
@@ -517,7 +556,14 @@ |
90 |
@@ -513,7 +552,14 @@ |
| 91 |
strcat(completeFilePath, defaultFileName); |
91 |
strcat(completeFilePath, defaultFileName); |
| 92 |
} |
92 |
} |
| 93 |
analyzeExtension(mimeType, completeFilePath); |
93 |
analyzeExtension(mimeType, completeFilePath); |
|
Lines 103-109
Link Here
|
| 103 |
} |
103 |
} |
| 104 |
} else if (!strcmp(req.method, "POST")) |
104 |
} else if (!strcmp(req.method, "POST")) |
| 105 |
{ |
105 |
{ |
| 106 |
@@ -531,13 +577,6 @@ |
106 |
@@ -527,13 +573,6 @@ |
| 107 |
int readFinished; |
107 |
int readFinished; |
| 108 |
|
108 |
|
| 109 |
printf("Handling of POST method\n"); |
109 |
printf("Handling of POST method\n"); |
|
Lines 114-123
Link Here
|
| 114 |
- sayError(sock, UNHANDLED_METHOD, "", req); |
114 |
- sayError(sock, UNHANDLED_METHOD, "", req); |
| 115 |
- return -1; |
115 |
- return -1; |
| 116 |
- } |
116 |
- } |
|
|
117 |
#ifdef ENABLE_CGI |
| 117 |
#ifdef PRINTF_DEBUG |
118 |
#ifdef PRINTF_DEBUG |
| 118 |
printf ("begin of post handling\n"); |
119 |
printf ("begin of post handling\n"); |
| 119 |
|
120 |
@@ -550,7 +589,7 @@ |
| 120 |
@@ -553,7 +592,7 @@ |
|
|
| 121 |
return -1; |
121 |
return -1; |
| 122 |
} else if (req.contentLength >= BUFFER_SIZE) |
122 |
} else if (req.contentLength >= BUFFER_SIZE) |
| 123 |
{ |
123 |
{ |
|
Lines 126-132
Link Here
|
| 126 |
return -1; |
126 |
return -1; |
| 127 |
} |
127 |
} |
| 128 |
while (!readFinished) |
128 |
while (!readFinished) |
| 129 |
@@ -631,7 +670,77 @@ |
129 |
@@ -628,7 +667,77 @@ |
| 130 |
#ifdef PRINTF_DEBUG |
130 |
#ifdef PRINTF_DEBUG |
| 131 |
printf("buff: |%s|\n", buff); |
131 |
printf("buff: |%s|\n", buff); |
| 132 |
#endif |
132 |
#endif |
|
Lines 203-211
Link Here
|
| 203 |
+#endif |
203 |
+#endif |
| 204 |
+ } |
204 |
+ } |
| 205 |
} |
205 |
} |
| 206 |
} else |
206 |
#endif /* ENABLE_CGI */ |
| 207 |
{ |
207 |
#ifndef ENABLE_CGI |
| 208 |
@@ -660,7 +769,7 @@ |
208 |
@@ -664,7 +773,7 @@ |
| 209 |
f = fopen(configFile, "r"); |
209 |
f = fopen(configFile, "r"); |
| 210 |
if (f == NULL) |
210 |
if (f == NULL) |
| 211 |
{ |
211 |
{ |
|
Lines 214-220
Link Here
|
| 214 |
*serverPort = DEFAULT_PORT; |
214 |
*serverPort = DEFAULT_PORT; |
| 215 |
*maxChildren = DEFAULT_MAX_CHILDREN; |
215 |
*maxChildren = DEFAULT_MAX_CHILDREN; |
| 216 |
strcpy(homePath, DEFAULT_DOCS_LOCATION); |
216 |
strcpy(homePath, DEFAULT_DOCS_LOCATION); |
| 217 |
@@ -669,7 +778,9 @@ |
217 |
@@ -673,7 +782,9 @@ |
| 218 |
sockTimeVal.tv_usec = DEFAULT_USEC_TO; |
218 |
sockTimeVal.tv_usec = DEFAULT_USEC_TO; |
| 219 |
strcpy(logFileName, DEFAULT_LOG_FILE); |
219 |
strcpy(logFileName, DEFAULT_LOG_FILE); |
| 220 |
strcpy(mimeTypesFileName, DEFAULT_MIME_FILE); |
220 |
strcpy(mimeTypesFileName, DEFAULT_MIME_FILE); |
|
Lines 224-230
Link Here
|
| 224 |
return -1; |
224 |
return -1; |
| 225 |
} |
225 |
} |
| 226 |
if (!feof(f)) fscanf(f, "%s %s", str1, str2); |
226 |
if (!feof(f)) fscanf(f, "%s %s", str1, str2); |
| 227 |
@@ -770,11 +881,25 @@ |
227 |
@@ -774,11 +885,25 @@ |
| 228 |
if (mimeTypesFileName == NULL) |
228 |
if (mimeTypesFileName == NULL) |
| 229 |
{ |
229 |
{ |
| 230 |
strcpy(mimeTypesFileName, DEFAULT_MIME_FILE); |
230 |
strcpy(mimeTypesFileName, DEFAULT_MIME_FILE); |
|
Lines 252-258
Link Here
|
| 252 |
} |
252 |
} |
| 253 |
if (!feof(f)) fscanf(f, "%s %s", str1, str2); |
253 |
if (!feof(f)) fscanf(f, "%s %s", str1, str2); |
| 254 |
if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot")) |
254 |
if (str1 != NULL && str2 != NULL && !strcmp(str1, "cgiRoot")) |
| 255 |
@@ -1008,7 +1133,7 @@ |
255 |
@@ -1012,7 +1137,7 @@ |
| 256 |
} */ |
256 |
} */ |
| 257 |
} else |
257 |
} else |
| 258 |
{ |
258 |
{ |