Browse Source

submit some test

lusa 5 years ago
parent
commit
5cdce890e9

BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgoahead-mbedtls.a


+ 4 - 3
app/goahead-5.1.0/build/linux-arm-static/inc/goahead.h

@@ -3993,6 +3993,10 @@ PUBLIC int websSetSessionVar(Webs *wp, cchar *name, cchar *value);
 //add by lusa
 PUBLIC void personInfoAction(Webs *wp);
 
+PUBLIC void getDeviceInfo(Webs *wp);
+
+
+PUBLIC void getDeviceInfoBak(Webs *wp);
 /************************************ Legacy **********************************/
 /*
     Legacy mappings for pre GoAhead 3.X applications
@@ -4180,9 +4184,6 @@ PUBLIC void personInfoAction(Webs *wp);
  #include "customize.h"
 #endif
 
-
-void getDeviceInfo(Webs *wp);
-
 #ifdef __cplusplus
 }
 #endif

+ 2 - 16
app/goahead-5.1.0/projects/goahead-linux-static.mk

@@ -140,10 +140,7 @@ clean:
 	rm -f "$(BUILD)/bin/libgo.a"
 	rm -f "$(BUILD)/bin/libgoahead-mbedtls.a"
 	rm -f "$(BUILD)/bin/libmbedtls.a"
-#jimbo	
-	rm -f "$(BUILD)/bin/libipmi_session.o"
-	rm -f "$(BUILD)/bin/libipmi_uds_session.o"
-	rm -f "$(BUILD)/bin/libipmi_IPM.o"
+
 clobber: clean
 	rm -fr ./$(BUILD)
 
@@ -297,10 +294,6 @@ $(BUILD)/obj/libipmi_uds_session.o: \
     src/libipmi/src/libipmi_uds_session.c $(DEPS_USER_C2)
 	@echo '   [Compile] $(BUILD)/obj/libipmi_uds_session.o'
 	$(CC) -c -o $(BUILD)/obj/libipmi_uds_session.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_uds_session.c
-$(BUILD)/obj/libipmi_IPM.o: \
-    src/libipmi/src/libipmi_IPM.c $(DEPS_USER_C2)
-	@echo '   [Compile] $(BUILD)/obj/libipmi_IPM.o'
-	$(CC) -c -o $(BUILD)/obj/libipmi_IPM.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_IPM.c
 
 #
 #   LUSA, ResultUtils
@@ -656,19 +649,12 @@ DEPS_36 += $(BUILD)/obj/time.o
 DEPS_36 += $(BUILD)/obj/upload.o
 DEPS_36 += $(BUILD)/obj/libipmi_session.o
 DEPS_36 += $(BUILD)/obj/libipmi_uds_session.o
-DEPS_36 += $(BUILD)/obj/libipmi_IPM.o
 
 
 
 $(BUILD)/bin/libgo.a: $(DEPS_36)
 	@echo '      [Link] $(BUILD)/bin/libgo.a'
-	$(AR) -cr $(BUILD)/bin/libgo.a "$(BUILD)/obj/ResultUtils.o" "$(BUILD)/obj/action.o" \
-		"$(BUILD)/obj/alloc.o" "$(BUILD)/obj/auth.o" "$(BUILD)/obj/cgi.o" "$(BUILD)/obj/crypt.o" \
-		"$(BUILD)/obj/file.o" "$(BUILD)/obj/fs.o" "$(BUILD)/obj/http.o" "$(BUILD)/obj/js.o" \
-		"$(BUILD)/obj/jst.o" "$(BUILD)/obj/options.o" "$(BUILD)/obj/osdep.o" "$(BUILD)/obj/rom.o" \
-		"$(BUILD)/obj/route.o" "$(BUILD)/obj/runtime.o" "$(BUILD)/obj/socket.o" "$(BUILD)/obj/time.o" \
-		"$(BUILD)/obj/upload.o" "$(BUILD)/obj/cJSON.o" "$(BUILD)/obj/libipmi_session.o" \
-		"$(BUILD)/obj/libipmi_uds_session.o" "$(BUILD)/obj/libipmi_IPM.o"
+	$(AR) -cr $(BUILD)/bin/libgo.a "$(BUILD)/obj/ResultUtils.o" "$(BUILD)/obj/action.o" "$(BUILD)/obj/alloc.o" "$(BUILD)/obj/auth.o" "$(BUILD)/obj/cgi.o" "$(BUILD)/obj/crypt.o" "$(BUILD)/obj/file.o" "$(BUILD)/obj/fs.o" "$(BUILD)/obj/http.o" "$(BUILD)/obj/js.o" "$(BUILD)/obj/jst.o" "$(BUILD)/obj/options.o" "$(BUILD)/obj/osdep.o" "$(BUILD)/obj/rom.o" "$(BUILD)/obj/route.o" "$(BUILD)/obj/runtime.o" "$(BUILD)/obj/socket.o" "$(BUILD)/obj/time.o" "$(BUILD)/obj/upload.o" "$(BUILD)/obj/cJSON.o" "$(BUILD)/obj/libipmi_session.o" "$(BUILD)/obj/libipmi_uds_session.o" 
 
 #
 #   install-certs

+ 12 - 1
app/goahead-5.1.0/src/auth.c

@@ -96,26 +96,32 @@ PUBLIC bool websAuthenticate(Webs *wp)
         return 1;
     }
     cached = 0;
+    logmsg(2,"-----------------------session555---------%s--------------", wp->cookie);
     if (wp->cookie && websGetSession(wp, 0) != 0) {
         /*
             Retrieve authentication state from the session storage. Faster than re-authenticating.
          */
+        logmsg(2,"-----------------------session-------%s----------------%s", wp->authType, route->authType);
         if ((username = (char*) websGetSessionVar(wp, WEBS_SESSION_USERNAME, 0)) != 0) {
             cached = 1;
+            logmsg(2,"-----------------------session2222-----------------------");
             wfree(wp->username);
             wp->username = sclone(username);
         }
     }
     if (!cached) {
+        logmsg(2,"-----------------------33-------%s----------------%s", wp->authType, route->authType);
         if (wp->authType && !smatch(wp->authType, route->authType)) {
             websError(wp, HTTP_CODE_UNAUTHORIZED, "Access denied. Wrong authentication protocol type.");
             return 0;
         }
+        logmsg(2,"----------------------hh-----------------------");
         if (wp->authDetails && route->parseAuth) {
             if (!(route->parseAuth)(wp)) {
                 wp->username = 0;
             }
         }
+        logmsg(2,"-----------------------jj----------------------");
         if (!wp->username || !*wp->username) {
             if (route->askLogin) {
                 (route->askLogin)(wp);
@@ -123,6 +129,7 @@ PUBLIC bool websAuthenticate(Webs *wp)
             websRedirectByStatus(wp, HTTP_CODE_UNAUTHORIZED);
             return 0;
         }
+        logmsg(2,"----------------------kk-------------------");
         if (!(route->verify)(wp)) {
             if (route->askLogin) {
                 (route->askLogin)(wp);
@@ -515,7 +522,9 @@ PUBLIC bool websLoginUser(Webs *wp, cchar *username, cchar *password)
     }
     trace(2, "Login successful for %s", username);
     websCreateSession(wp);
+    logmsg(2, "%s-----------4444444444444444---------", wp->route);
     websSetSessionVar(wp, WEBS_SESSION_USERNAME, wp->username);
+     logmsg(2, "%s-----------777777777777777---------", wp->route);
     return 1;
 }
 
@@ -564,11 +573,13 @@ static void loginServiceProc(Webs *wp)
             websRedirectByStatus(wp, HTTP_CODE_OK);
         }*/
 
-        successResult(wp);
         //end 
         websSetSessionVar(wp, "loginStatus", "ok");
 
         websSetSessionVar(wp, "lang", "en");
+
+        successResult(wp);
+        
     } else {
         if (route->askLogin) {
             (route->askLogin)(wp);

+ 76 - 34
app/goahead-5.1.0/src/goahead.c

@@ -21,7 +21,8 @@
 #include    "com_IPMI_App.h"
 #include    "libipmi_IPM.h"
 #include    "com_IPMIDefs.h"
-
+#include    "ResultUtils.h"
+#include    "cJSON.h"
 /********************************* Defines ************************************/
 
 static int finished = 0;
@@ -42,47 +43,84 @@ static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp);
 static void sigHandler(int signo);
 #endif
 
-// static void buy(Webs *wp);
-// static void actionTest(Webs *wp);
+static void buy(Webs *wp);
+static void actionTest(Webs *wp);
 // static void personInfoAction(Webs *wp);
 
 
-// static void buy(Webs *wp)
-// {
-//     char    *name, *age;
-//     name = websGetVar(wp, "name", NULL);
-//     age = websGetVar(wp, "age", NULL);
-//      logmsg(2, "---------------------------------------------");
-//     logmsg(2, "name value is : %s", name );
-//      logmsg(2, "age value is : %s", age );
-//     websSetStatus(wp, 200);
-//     websWriteHeaders(wp, 0, 0);
-//     websWriteEndHeaders(wp);
-//     printf("aa");
-//     websWrite(wp, "Name %s", name); 
-//     websWrite(wp,  "Age %s", age);
-//     websFlush(wp, 0);
-//     websDone(wp);
-// }
+static void buy(Webs *wp)
+{
+    cchar    *name, *age;
+    name = websGetVar(wp, "name", NULL);
+    age = websGetVar(wp, "age", NULL);
+     logmsg(2, "----------------------------11-----------------");
+    logmsg(2, "name value is : %s", name );
+     logmsg(2, "age value is : %s", age );
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp);
+   
+    websWrite(wp, "Name %s", name);
+    websWrite(wp, "age %s", age); 
+    websFlush(wp, 0);
+    websDone(wp);
+}
 
 
 
 // /*
 //     Implement /action/actionTest. Parse the form variables: name, address and echo back.
 //  */
-// static void actionTest(Webs *wp)
-// {
-//     cchar   *name, *address;
+static void actionTest(Webs *wp)
+{
+
 
-//     name = websGetVar(wp, "name", NULL);
-//     address = websGetVar(wp, "address", NULL);
-//     websSetStatus(wp, 200);
-//     websWriteHeaders(wp, -1, 0);
-//     websWriteEndHeaders(wp);
-//     websWrite(wp, "<html><body><h2>name: %s, address: %s</h2></body></html>\n", name, address);
-//     websFlush(wp, 0);
-//     websDone(wp);
-// }
+logmsg(2, "--------------------ggggggggg----------------");
+
+    uint16_t    wRet = LIBIPMI_E_SUCCESS;
+    GetDevIDRes_T   DeviceID;
+    char BuildTime[30] = {0};
+    char FwVersion[10] = {0};
+    //Create session
+    LIBIPMI_CreateSession(&wp->ipmi_session, 10);
+    sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
+    wRet = IPMICMD_GetDeviceID( &wp->ipmi_session, &DeviceID, DEFAULT_TIMEOUT);
+    if (wRet == LIBIPMI_E_SUCCESS)
+    {
+        sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
+    }
+    printf("BuildTime: %s\n", BuildTime);
+    printf("FwVersion: %s\n", FwVersion);
+    //Close session
+    LIBIPMI_CloseSession(&wp->ipmi_session );
+    // cchar *pStr;
+    // int code = 200;
+    // cJSON * root =  cJSON_CreateObject();
+    // cJSON * data =  cJSON_CreateObject();
+    // // cJSON * next =  cJSON_CreateObject();
+    // cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    // cJSON_AddItemToObject(root, "msg", cJSON_CreateString(""));
+    // cJSON_AddItemToObject(root, "code", cJSON_CreateString("200"));
+    // cJSON_AddStringToObject(data, "BuildTime", BuildTime);
+    // cJSON_AddStringToObject(data, "FwVersion", FwVersion);
+
+    // pStr = cJSON_Print(root);
+
+    // printf("first json:\n%s\n", pStr);
+
+
+
+    cchar   *name, *address;
+
+    name = websGetVar(wp, "name", NULL);
+    address = websGetVar(wp, "address", NULL);
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp);
+    websWrite(wp, "Name %s", name);
+    websFlush(wp, 0);
+    websDone(wp);
+}
 
 
 
@@ -212,8 +250,12 @@ MAIN(goahead, int argc, char **argv, char **envp)
 #endif
 
 //add by lusa start 
-        // websDefineAction("buy", buy);
-        websDefineAction("getDeviceInfo", getDeviceInfo);
+        websDefineAction("buy", buy);
+         websDefineAction("actionTest", actionTest);
+        websDefineAction("deviceinfo", getDeviceInfo);
+
+        websDefineAction("getDeviceInfoBak", getDeviceInfoBak);
+
         websDefineAction("person", personInfoAction);
 
 

+ 4 - 3
app/goahead-5.1.0/src/goahead.h

@@ -3993,6 +3993,10 @@ PUBLIC int websSetSessionVar(Webs *wp, cchar *name, cchar *value);
 //add by lusa
 PUBLIC void personInfoAction(Webs *wp);
 
+PUBLIC void getDeviceInfo(Webs *wp);
+
+
+PUBLIC void getDeviceInfoBak(Webs *wp);
 /************************************ Legacy **********************************/
 /*
     Legacy mappings for pre GoAhead 3.X applications
@@ -4180,9 +4184,6 @@ PUBLIC void personInfoAction(Webs *wp);
  #include "customize.h"
 #endif
 
-
-void getDeviceInfo(Webs *wp);
-
 #ifdef __cplusplus
 }
 #endif

+ 21 - 18
app/goahead-5.1.0/src/http.c

@@ -1728,28 +1728,31 @@ PUBLIC void websRedirect(Webs *wp, cchar *uri)
 PUBLIC int websRedirectByStatus(Webs *wp, int status)
 {
 
-    logmsg(2,"--------------------------------Warning come in redirect TODO fix this-------------------- ");
-    // WebsKey     *key;
-    // char        code[16], *uri;
+    logmsg(2,"--------------------------------Warning come in redirect TODO1 fix this-------------------- ");
+    WebsKey     *key;
+    char        code[16], *uri;
 
-    // assert(wp);
-    // assert(status >= 0);
+    assert(wp);
+    assert(status >= 0);
 
     if (wp->route && wp->route->redirects >= 0) {
-         logmsg(2,"--------------------------------Warning come in redirect TODO fix this-------------------- ");
-    //     itosbuf(code, sizeof(code), status, 10);
-    //     if ((key = hashLookup(wp->route->redirects, code)) != 0) {
-    //         uri = key->content.value.string;
-    //     } else {
-    //         return -1;
-    //     }
-    //     websRedirect(wp, uri);
+         logmsg(2,"--------------------------------Warning come in redirect TODO2 fix this-------------------- ");
+        itosbuf(code, sizeof(code), status, 10);
+        if ((key = hashLookup(wp->route->redirects, code)) != 0) {
+            uri = key->content.value.string;
+        } else {
+            return -1;
+        }
+        websRedirect(wp, uri);
     } else {
-    //     if (status == HTTP_CODE_UNAUTHORIZED) {
-    //         websError(wp, status, "Access Denied. User not logged in.");
-    //     } else {
-    //         websError(wp, status, 0);
-    //     }
+
+        if (status == HTTP_CODE_UNAUTHORIZED) {
+             logmsg(2,"--------------------------------Warning come in redirect TODO3 fix this-------------------- ");
+            websError(wp, status, "Access Denied. User not logged in.");
+        } else {
+            logmsg(2,"--------------------------------Warning come in redirect TODO4fix this-------------------- ");
+            websError(wp, status, 0);
+        }
     }
     return 0;
 }

+ 13 - 12
app/goahead-5.1.0/src/libipmi/src/libipmi_uds_session.c

@@ -135,6 +135,7 @@ uint32_t FillUDSMessagePacket(IPMI20_SESSION_T *pSession, uint8_t *Buffer,
 
     memcpy(pUDSMsg->UserName, pSession->hUDSSession->szUName, MAX_USER_NAME_LEN);
     memcpy(pUDSMsg->IPAddr, pSession->hUDSSession->abyIPAddr, IP6_ADDR_LEN);
+    printf("---> FillUDSMessagePacket log2\n");
     pUDSMsg->ProcessID = getpid();
     pUDSMsg->ThreadID = gettid();
     memcpy(pbyIPMIUDSData, pbyReqData, dwReqDataLen);
@@ -207,11 +208,11 @@ uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSi
                 return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
             }
 
-            // int i;
-            // printf("---> client recv %#x: ", nBytesRecvd);
-            // for(i=0;i<nBytesRecvd;i++)
-            //     printf("%#x ", szBuffer[totalrecvd+i]);
-            // printf("\n");
+            int i;
+            printf("---> client recv %#x: ", nBytesRecvd);
+            for(i=0;i<nBytesRecvd;i++)
+                printf("%#x ", szBuffer[totalrecvd+i]);
+            printf("\n");
 
             totalrecvd += nBytesRecvd;
 
@@ -294,13 +295,13 @@ TCPSendUDSDataSelect:
             
             nBytesSent = send (UDSInfo->hSocket,szBuffer+nTotalBytesSent,dwsize, MSG_NOSIGNAL);
             
-            // int i=0;
-            // printf("---> client Send %#x: ",  nBytesSent);
-            // for (i = 0; i < nBytesSent; ++i)
-            // {
-            //     printf("%#x ", szBuffer[nTotalBytesSent+i]);
-            // }
-            // printf("\n");
+            int i=0;
+            printf("---> client Send %#x: ",  nBytesSent);
+            for (i = 0; i < nBytesSent; ++i)
+            {
+                printf("%#x ", szBuffer[nTotalBytesSent+i]);
+            }
+            printf("\n");
 
             /* send failure */
             if ((nBytesSent == SOCKET_ERROR) && ((EBADF == errno) || (EPIPE == errno)))

+ 75 - 11
app/goahead-5.1.0/src/route.c

@@ -17,7 +17,8 @@
 #include    "goahead.h"
 #include    "libipmi_IPM.h"
 #include    "com_IPMIDefs.h"
-
+#include    "ResultUtils.h"
+#include    "cJSON.h"
 /*********************************** Locals ***********************************/
 
 static WebsRoute **routes = 0;
@@ -92,27 +93,86 @@ void getDeviceInfo(Webs *wp){
     GetDevIDRes_T   DeviceID;
     char BuildTime[30] = {0};
     char FwVersion[10] = {0};
-
     //Create session
     LIBIPMI_CreateSession(&wp->ipmi_session, 10);
-
     sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
     wRet = IPMICMD_GetDeviceID( &wp->ipmi_session, &DeviceID, DEFAULT_TIMEOUT);
     if (wRet == LIBIPMI_E_SUCCESS)
     {
         sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
     }
-
     printf("BuildTime: %s\n", BuildTime);
     printf("FwVersion: %s\n", FwVersion);
+    //Close session
+    LIBIPMI_CloseSession(&wp->ipmi_session );
+    char *pStr;
+    int code = 200;
+    cJSON * root =  cJSON_CreateObject();
+    cJSON * data =  cJSON_CreateObject();
+    // cJSON * next =  cJSON_CreateObject();
+    cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    cJSON_AddItemToObject(root, "msg", cJSON_CreateString(""));
+    cJSON_AddItemToObject(root, "code", cJSON_CreateString("200"));
+    cJSON_AddStringToObject(data, "BuildTime", BuildTime);
+    cJSON_AddStringToObject(data, "FwVersion", FwVersion);
+
+    pStr = cJSON_Print(root);
+
+    printf("first json:\n%s\n", pStr);
+    logmsg(2, "-----------------------jso1n----------------------%s", pStr);
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp); 
+    websWrite(wp, "[ {\"name\":\"kangkang\",\"age\":\"12\",\"gender\":\"male\"}, {\"name\":\"Jane\",\"age\":\"14\",\"gender\":\"female\"}]");
+    websDone(wp);
+    // retrun 1;
+}
+/*获取设备信息*/
+void getDeviceInfoBak(Webs *wp){
+    logmsg(2, "--------------------ggggggggg----------------");
 
+    uint16_t    wRet = LIBIPMI_E_SUCCESS;
+    GetDevIDRes_T   DeviceID;
+    char BuildTime[30] = {0};
+    char FwVersion[10] = {0};
+    //Create session
+    LIBIPMI_CreateSession(&wp->ipmi_session, 10);
+    sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
+    wRet = IPMICMD_GetDeviceID( &wp->ipmi_session, &DeviceID, DEFAULT_TIMEOUT);
+    if (wRet == LIBIPMI_E_SUCCESS)
+    {
+        sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
+    }
+    printf("BuildTime: %s\n", BuildTime);
+    printf("FwVersion: %s\n", FwVersion);
     //Close session
     LIBIPMI_CloseSession(&wp->ipmi_session );
-    
-    
+    cchar *pStr;
+    int code = 200;
+    cJSON * root =  cJSON_CreateObject();
+    cJSON * data =  cJSON_CreateObject();
+    // cJSON * next =  cJSON_CreateObject();
+    cJSON_AddItemToObject(root, "data", data);//根节点下添加
+    cJSON_AddItemToObject(root, "msg", cJSON_CreateString(""));
+    cJSON_AddItemToObject(root, "code", cJSON_CreateString("200"));
+    cJSON_AddStringToObject(data, "BuildTime", BuildTime);
+    cJSON_AddStringToObject(data, "FwVersion", FwVersion);
+
+    pStr = cJSON_Print(root);
+
+    printf("first json:\n%s\n", pStr);
+    logmsg(2, "-----------------------jso1n----------------------%s", pStr);
+
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp); 
+    websWrite(wp, "[ {\"name\":\"kangkang\",\"age\":\"12\",\"gender\":\"male\"}, {\"name\":\"Jane\",\"age\":\"14\",\"gender\":\"female\"}]");
+    websFlush(wp, 0);
+    websDone(wp);
 }
 
 
+
 /************************************ Code ************************************/
 /*
     Route the request. If wp->route is already set, test routes after that route
@@ -159,7 +219,7 @@ PUBLIC void websRouteRequest(Webs *wp)
 
     for (; i < routeCount; i++) {
         route = routes[i];
-         logmsg(2, "-----------------------0.2----------------------%s", route->prefix);
+         // logmsg(2, "-----------------------0.2----------------------%s", route->prefix);
         assert(route->prefix && route->prefixLen > 0);
 
         if (plen < route->prefixLen) continue;
@@ -193,11 +253,15 @@ PUBLIC void websRouteRequest(Webs *wp)
         wp->route = route;
          logmsg(2,"-----------------------11-----------------------");
 #if ME_GOAHEAD_AUTH
-          logmsg(2,"-----------------------22-----------------------%s", route->authType);
-        if (route->authType && !websAuthenticate(wp)) {
+        logmsg(2,"-----------------------22------------%#X-----------", route->authType);
+        if (route->authType) {
             // personInfoAction(wp);// 
-            logmsg(2,"-----------------------33-----------------------");
-            return;
+            logmsg(2,"-----------------------33--444---------------------");
+            if(!websAuthenticate(wp)){
+                logmsg(2,"-----------------------33--111---------------------");
+                return;
+            }
+            
         }
         if (route->abilities >= 0 && !websCan(wp, route->abilities)) {
             logmsg(2,"-----------------------44-----------------------");

+ 5 - 4
app/goahead-5.1.0/src/route.txt

@@ -41,10 +41,11 @@ route uri=/login.html
 route uri=/action/login methods=POST handler=action redirect=200@/index.html redirect=401@/login.html
 route uri=/action/logout methods=GET|POST handler=action redirect=200@/login.html
 route uri=/auth/form/ auth=form handler=continue abilities=manage redirect=401@/login.html
-route uri=/auth/getDeviceInfo auth=digest handler=continue methods=GET|POST abilities=manage
-route uri=/auth/person auth=digest handler=continue methods=GET|POST abilities=manage redirect=401@/login.html
 
-#route uri=/action/person methods=GET|POST handler=action 
+route uri=/auth/deviceinfo auth=digest handler=continue methods=GET|POST abilities=manage redirect=401@/login.html
+route uri=/auth/getDeviceInfoBak auth=digest handler=continue methods=GET|POST abilities=manage redirect=401@/login.html
+
+route uri=/action/person methods=GET|POST handler=action 
 
 #
 #   Support PUT and DELETE methods only for the BIT_GOAHEAD_PUT_DIR directory
@@ -60,7 +61,7 @@ route uri=/secure/ protocol=http redirect=https handler=redirect
 #   Standard routes
 #
 route uri=/cgi-bin handler=cgi
-route uri=/action handler=action auth=form
+route uri=/action handler=action 
 route uri=/ methods=OPTIONS|TRACE handler=options
 route uri=/ extensions=jst,asp handler=jst
 

+ 1 - 1
app/goahead-5.1.0/src/utils/mine/ResultUtils.c

@@ -31,7 +31,7 @@ static void commResult(Webs *wp, int msgCode, int httpStatus, int isSuccess) {
     // cJSON * next =  cJSON_CreateObject();
 
     cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    cJSON_AddItemToObject(root, "msg", cJSON_CreateString(websErrorMsg(msgCode)));
+    cJSON_AddItemToObject(root, "msg", "");
     cJSON_AddItemToObject(root, "code", cJSON_CreateNumber(msgCode));
     cJSON_AddItemToObject(root, "isSuccess", cJSON_CreateNumber(isSuccess));
     

BIN
gd32450i-eval.uImage