zhangbo 5 سال پیش
والد
کامیت
fe4d89ee47

+ 2 - 0
app/goahead-3.6.5/src/action.c

@@ -53,6 +53,7 @@ static bool actionHandler(Webs *wp)
         fn = (WebsAction) sp->content.value.symbol;
         assert(fn);
         if (fn) {
+            printf("---> actionName: %s\n", actionName);
 #if ME_GOAHEAD_LEGACY
             (*((WebsProc) fn))((void*) wp, actionName, wp->query);
 #else
@@ -60,6 +61,7 @@ static bool actionHandler(Webs *wp)
 #endif
         }
     }
+    printf("---> actionHandler return 1\n");
     return 1;
 }
 

+ 11 - 2
app/goahead-3.6.5/src/file.c

@@ -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;
 }
 

+ 1 - 0
app/goahead-3.6.5/src/goahead.c

@@ -126,6 +126,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
     printf("---> initPlatform\n");
     initPlatform();
     printf("---> websOpen\n");
+    printf(">>>>>>>>>>>>>>>>>>>>>>>>>>2>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
     if (websOpen(documents, route) < 0) {
         error("Cannot initialize server. Exiting.");
         return -1;

+ 6 - 0
app/goahead-3.6.5/src/http.c

@@ -1628,6 +1628,8 @@ PUBLIC void websRedirect(Webs *wp, char *uri)
             originalPort = atoi(pstr);
         }
     }
+
+    printf("---> originalPort: %d, hostbuf: %s\n", originalPort, hostbuf);
     if (smatch(uri, "http://") || smatch(uri, "https://")) {
         /* Protocol switch with existing Uri */
         scheme = sncmp(uri, "https", 5) == 0 ? "https" : "http";
@@ -1646,13 +1648,16 @@ PUBLIC void websRedirect(Webs *wp, char *uri)
         port = secure ? defaultSslPort : defaultHttpPort;
     }
     if (strstr(uri, "https:///")) {
+        printf("---> log1\n");
         /* Short-hand for redirect to https */
         uri = location = makeUri(scheme, hostbuf, port, &uri[8]);
 
     } else if (strstr(uri, "http:///")) {
+        printf("---> log2\n");
         uri = location = makeUri(scheme, hostbuf, port, &uri[7]);
 
     } else if (!fullyQualified) {
+        printf("---> log3\n");
         uri = location = makeUri(scheme, hostbuf, port, uri);
     }
     message = sfmt("<html><head></head><body>\r\n\
@@ -1660,6 +1665,7 @@ PUBLIC void websRedirect(Webs *wp, char *uri)
         Please update your documents to reflect the new location.\r\n\
         </body></html>\r\n", uri);
     len = slen(message);
+    printf("---> message: %s\n", message);
     websSetStatus(wp, HTTP_CODE_MOVED_TEMPORARILY);
     websWriteHeaders(wp, len + 2, uri);
     websWriteEndHeaders(wp);

+ 1 - 0
app/goahead-3.6.5/src/runtime.c

@@ -286,6 +286,7 @@ int websRunEvents()
     WebsTime    now;
     int         i, delay, nextEvent;
 
+    printf("---> websRunEvents\n");
     nextEvent = (MAXINT / 1000);
     now = time(0);
 

+ 1 - 1
app/goahead-3.6.5/src/socket.c

@@ -618,7 +618,7 @@ PUBLIC void socketProcess()
 {
     WebsSocket    *sp;
     int         sid;
-
+    printf("---> socketProcess\n");
     for (sid = 0; sid < socketMax; sid++) {
         if ((sp = socketList[sid]) != NULL) {
             if (sp->currentEvents & sp->handlerMask) {

+ 3 - 1
app/goahead-3.6.5/src/web/index.html

@@ -1 +1,3 @@
-<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>bmcui</title><link href=/static/css/dashbord.css rel=prefetch><link href=/static/css/fan.css rel=prefetch><link href=/static/css/index.css rel=prefetch><link href=/static/css/login.css rel=prefetch><link href=/static/css/sensor_history.css rel=prefetch><link href=/static/css/set_proctrol.css rel=prefetch><link href=/static/css/system_logs.css rel=prefetch><link href=/static/js/BSODScreen.js rel=prefetch><link href=/static/js/dashbord.js rel=prefetch><link href=/static/js/dashbord~index~login~sensor_history.js rel=prefetch><link href=/static/js/event_logs.js rel=prefetch><link href=/static/js/fan.js rel=prefetch><link href=/static/js/index.js rel=prefetch><link href=/static/js/login.js rel=prefetch><link href=/static/js/sensor_history.js rel=prefetch><link href=/static/js/set_proctrol.js rel=prefetch><link href=/static/js/system_logs.js rel=prefetch><link href=/static/css/app.css rel=preload as=style><link href=/static/css/chunk-vendors.css rel=preload as=style><link href=/static/js/app.js rel=preload as=script><link href=/static/js/chunk-vendors.js rel=preload as=script><link href=/static/css/chunk-vendors.css rel=stylesheet><link href=/static/css/app.css rel=stylesheet></head><body><div id=app></div><script src=/static/js/chunk-vendors.js></script><script src=/static/js/app.js></script></body></html>
+<html><head><title>index.html</title></head>
+<body>Hello /index.html</body>
+</html>