|
@@ -32,7 +32,7 @@ static bool fileHandler(Webs *wp)
|
|
|
assert(websValid(wp));
|
|
|
assert(wp->method);
|
|
|
assert(wp->filename && wp->filename[0]);
|
|
|
-
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>1.1>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
|
|
#if !ME_ROM
|
|
|
if (smatch(wp->method, "DELETE")) {
|
|
|
if (unlink(wp->filename) < 0) {
|
|
@@ -48,6 +48,7 @@ static bool fileHandler(Webs *wp)
|
|
|
} else
|
|
|
#endif /* !ME_ROM */
|
|
|
{
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>1.2>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
|
|
/*
|
|
|
If the file is a directory, redirect using the nominated default page
|
|
|
*/
|
|
@@ -57,10 +58,13 @@ static bool fileHandler(Webs *wp)
|
|
|
wp->path[--nchars] = '\0';
|
|
|
}
|
|
|
tmp = sfmt("%s/%s", wp->path, websIndex);
|
|
|
+ printf("---> tmp: %s\n", tmp);
|
|
|
websRedirect(wp, tmp);
|
|
|
wfree(tmp);
|
|
|
+ printf("---> fileHandler return 1\n");
|
|
|
return 1;
|
|
|
}
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>1.3>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
|
|
if (websPageOpen(wp, O_RDONLY | O_BINARY, 0666) < 0) {
|
|
|
#if ME_DEBUG
|
|
|
if (wp->referrer) {
|
|
@@ -70,12 +74,15 @@ static bool fileHandler(Webs *wp)
|
|
|
websError(wp, HTTP_CODE_NOT_FOUND, "Cannot open document for: %s", wp->path);
|
|
|
return 1;
|
|
|
}
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>1.4>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
|
|
if (websPageStat(wp, &info) < 0) {
|
|
|
websError(wp, HTTP_CODE_NOT_FOUND, "Cannot stat page for URL");
|
|
|
return 1;
|
|
|
}
|
|
|
code = 200;
|
|
|
- if (wp->since && info.mtime <= wp->since) {
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>4.3>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
|
|
+ if (wp->since && info.mtime <= wp->since) {//应该是这个判定的问题 正常来说 应该是 code=304
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>4.6>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
|
|
code = 304;
|
|
|
info.size = 0;
|
|
|
}
|
|
@@ -178,6 +185,7 @@ static void fileClose()
|
|
|
|
|
|
PUBLIC void websFileOpen()
|
|
|
{
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>>>333>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
|
|
websIndex = sclone("index.html");
|
|
|
websDefineHandler("file", 0, fileHandler, fileClose, 0);
|
|
|
}
|
|
@@ -188,6 +196,7 @@ PUBLIC void websFileOpen()
|
|
|
*/
|
|
|
PUBLIC char *websGetIndex()
|
|
|
{
|
|
|
+ printf(">>>>>>>>>>>>>>>>>>>>>>>>is here ???>>>>>>>>>>>>>>>>>>>>>>");
|
|
|
return websIndex;
|
|
|
}
|
|
|
|