20190503_jeffrey - silenceuncrio/diary GitHub Wiki

0905

繼續 lighttpd

目前有一支可以執行的 fastcgi - TinyFastCGI

試著先把 /cgi-bin/status.cgi?act=status 搬過來

前端不改的話 可以利用 lighttpd URL Rewrites

來把 /cgi-bin/status.cgi?act=status 對應成 /fcgi-bin/tiny.fcgi?cgi=status&act=status

先報考慮 URL Rewrites

/fcgi-bin/tiny.fcgi?cgi=status&act=status 而言

這是一個 HTTP GET request

parameter 有

  • cgi=status
  • act=status

我該如何把 cgi 以及 act 這兩個參數取出來呢

之前 cgi 用的是 cgilib 這一套 library

取參數用的 api 是 cgiGetValue()

實在不確定一樣的東西在 fcgi 能不能繼續使用

1130

確認以下的 code 可以搭配 cgilib 使用

#include <stdlib.h>
#include <fcgi_stdio.h>

#include "cgi.h"

int count;

void initialize(void)
{
    count = 0;
}

void main(void)
{
    /* Initialization. */
    initialize();

    /* Response loop. */
    while (FCGI_Accept() >= 0)
    {

        s_cgi *cgi = cgiInit();

        char *act = cgiGetValue(cgi, "act");

        printf("Content-type: text/html\r\n"
               "\r\n"
               "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
               "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
               "Request number %d<br>"
               "GET parameter:<br>"
               "  act: %s<br>"
               "<br>\n",
               ++count, act);

        cgiFree (cgi);

    }
}

執行結果如下

image

1145

commit 5c8c283633f55693a9cdcb478586388b500d2d6e
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date:   Fri May 3 11:45:06 2019 +0800

    now tiny.fcgi can use the same libcgi library as previous webcgi

 proscend/prosrc/fcgi/.gitignore                   |    2 +
 proscend/prosrc/fcgi/Makefile                     |   22 +-
 proscend/prosrc/fcgi/cgilib-0.7/AUTHORS           |   31 +
 proscend/prosrc/fcgi/cgilib-0.7/COPYING           |  339 +
 proscend/prosrc/fcgi/cgilib-0.7/ChangeLog         |   60 +
 proscend/prosrc/fcgi/cgilib-0.7/INSTALL           |   56 +
 proscend/prosrc/fcgi/cgilib-0.7/Makefile          |   48 +
 proscend/prosrc/fcgi/cgilib-0.7/Makefile.am       |   33 +
 proscend/prosrc/fcgi/cgilib-0.7/Makefile.in       |  793 +++
 proscend/prosrc/fcgi/cgilib-0.7/aux.C             |  243 +
 proscend/prosrc/fcgi/cgilib-0.7/aux.H             |   31 +
 proscend/prosrc/fcgi/cgilib-0.7/aux.O             |  Bin 0 -> 5224 bytes
 proscend/prosrc/fcgi/cgilib-0.7/aux_x.c           |  289 +
 proscend/prosrc/fcgi/cgilib-0.7/aux_x.h           |   31 +
 proscend/prosrc/fcgi/cgilib-0.7/cgi.5             |  118 +
 proscend/prosrc/fcgi/cgilib-0.7/cgi.c             | 1263 ++++
 proscend/prosrc/fcgi/cgilib-0.7/cgi.h             |  178 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiDebug.3        |   48 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiEscape.3       |   48 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiFree.3         |   51 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiFreeList.3     |   43 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiGetCookie.3    |   80 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiGetCookies.3   |   49 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiGetFile.3      |   64 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiGetFiles.3     |   48 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiGetValue.3     |   55 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiGetVariables.3 |   51 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiHeader.3       |   49 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiInit.3         |   75 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiRedirect.3     |   45 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiSetHeader.3    |   74 +
 proscend/prosrc/fcgi/cgilib-0.7/cgiSetType.3      |   45 +
 proscend/prosrc/fcgi/cgilib-0.7/cgitest.c         |  308 +
 proscend/prosrc/fcgi/cgilib-0.7/config.guess      | 1526 +++++
 proscend/prosrc/fcgi/cgilib-0.7/config.sub        | 1658 +++++
 proscend/prosrc/fcgi/cgilib-0.7/configure.ac      |   14 +
 proscend/prosrc/fcgi/cgilib-0.7/cookies.c         |  229 +
 proscend/prosrc/fcgi/cgilib-0.7/cookies.txt       |   81 +
 proscend/prosrc/fcgi/cgilib-0.7/depcomp           |  589 ++
 proscend/prosrc/fcgi/cgilib-0.7/install-sh        |  519 ++
 proscend/prosrc/fcgi/cgilib-0.7/jumpto.c          |   76 +
 proscend/prosrc/fcgi/cgilib-0.7/ltmain.sh         | 6964 +++++++++++++++++++++
 proscend/prosrc/fcgi/cgilib-0.7/missing           |  367 ++
 proscend/prosrc/fcgi/tiny.c                       |   28 +-
 proscend/prosrc/fcgi/tiny.fcgi                    |  Bin 4100 -> 4368 bytes
 45 files changed, 16706 insertions(+), 15 deletions(-)

1305

M300 的 setting wizard 出了不少 bug

  • 0000510: [Wizard] change password , but login new password fail
  • 0000511: [Wizard] change LAN IP and range, it will hang up
  • 0000512: [Login] Login wrong password, it will hang up
  • 0000513: [Wizard] changr time zone, but reboot finished, time zone is still old

M300 先 build 個 branch release/v2.00

1325

先 check 0000510: [Wizard] change password , but login new password fail

這個確定已經解決了

1330

再 check 0000511: [Wizard] change LAN IP and range, it will hang up

先試一次 並沒有 apply fail

開完機再試一次 lan module 還是 apply 成功

1335

改來看 0000512: [Login] Login wrong password, it will hang up

commit bc9232a0bb96453e98bff025c5ceed7e1436d7a8
Refs: [release/v2.00], {origin/release/v2.00}
Author: jeffrey <[email protected]>
Date:   Fri May 3 13:41:24 2019 +0800

    solve issue 0000512: [Login] Login wrong password, it will hang up

 proscend/prosrc/www/app/feature/login.js | 1 +
 1 file changed, 1 insertion(+)

1340

check 0000513: [Wizard] changr time zone, but reboot finished, time zone is still old

這跟 密碼的問題一樣

改成 apply 就好了

1400

先盤一下周報內容

  • M330
    • add 'WiFi > MAC Filter' web page
    • add 'VLAN Isolation' field at 'VLAN' web page
    • add 'IP Address Selection' field at 'Dynamic DNS' web page
    • add 'WAN/LAN2 Port Function' field at 'System > Ethernet Ports' web page
      • also add hint at 'WAN > Priority' page
    • fix issue - 0000461: user can't apply anything in "Time and Date"
  • M300
    • change web server to avoid https ustable
    • solve issue 0000506: M30TG, save the new password compelete via setup wizard but it can't activy
    • solve issue 0000510: [Wizard] change password , but login new password fail
    • solve issue 0000512: [Login] Login wrong password, it will hang up
    • solve issue 0000513: [Wizard] changr time zone, but reboot finished, time zone is still old

1420

再多試幾次 0000511: [Wizard] change LAN IP and range, it will hang up

如果 DHCP Server 的 IP Address Pool 故意和 IP Address 網段不一樣的話

image

那 apply fail 就沒有任何補救的機制 image

需要想個辦法

我可以利用 sweet alert 盤跳一個提示視窗並在使用者按下視窗上的 button 後 跳回該 step 讓使用者有機會修改

1505

用最保險的方式掃台

commit 3675d955a48a15878cd03baf7ebb6cba7ca9e29b
Author: jeffrey <[email protected]>
Date:   Fri May 3 15:01:17 2019 +0800

    solve issue 0000511: [Wizard] change LAN IP and range, it will hang up

diff --git a/proscend/prosrc/www/app/feature/wizard.js b/proscend/prosrc/www/app/feature/wizard.js
index b4af971..fc86e46 100644
--- a/proscend/prosrc/www/app/feature/wizard.js
+++ b/proscend/prosrc/www/app/feature/wizard.js
@@ -123,6 +123,11 @@
       }, function(response) {
         console.log("step 1 apply fail");
         vm.step_1.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_1.show();});^M
       });

     };
@@ -171,6 +176,11 @@
       }, function(response) {
         console.log("step 2 apply fail");
         vm.step_2.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2.show();});^M
       });

     };
@@ -296,6 +306,11 @@
       }, function(response) {
         console.log("step 2.1 apply fail: icos.wanst.set()");
         vm.step_2_1.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       })
       .then( function(response) {
         console.log("icos.dns_static.apply() ok");
@@ -304,6 +319,11 @@
       }, function(response) {
         console.log("step 2.1 apply fail: icos.dns_static.apply()");
         vm.step_2_1.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       })
       .then( function(response) {
           console.log("step 2.1 apply ok");
@@ -314,6 +334,11 @@
       }, function(response) {
         console.log("step 2.1 apply fail: icos.connmgr.chg_wproto_apply()");
         vm.step_2_1.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       });


@@ -330,6 +355,11 @@
       }, function(response) {
         vm.step_2_1.apply_status = "Apply fail";
         console.log("step 2.1 apply fail: icos.dns_dhcpc.set()");
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       })
       .then( function(response) {
           console.log("step 2.1 apply ok");
@@ -340,6 +370,11 @@
       }, function(response) {
         vm.step_2_1.apply_status = "Apply fail";
         console.log("step 2.1 apply fail: icos.connmgr.chg_wproto_apply()");
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       });

     };
@@ -353,6 +388,11 @@
       }, function(response) {
         vm.step_2_1.apply_status = "Apply fail";
         console.log("step 2.1 apply fail: icos.pppoe.apply()");
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       })
       .then( function(response) {
         console.log("icos.ipv6lan.default() ok");
@@ -361,6 +401,11 @@
       }, function(response) {
         vm.step_2_1.apply_status = "Apply fail";
         console.log("step 2.1 apply fail: icos.ipv6lan.default()");
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       })
       .then( function(response) {
           console.log("step 2.1 apply ok");
@@ -371,6 +416,11 @@
       }, function(response) {
         console.log("step 2.1 apply fail: icos.connmgr.chg_wproto_apply()");
         vm.step_2_1.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.1 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_1.show();});^M
       });

     };
@@ -463,6 +513,11 @@
       }, function(response) {
         console.log("step 2.2 apply fail");
         vm.step_2_2.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 2.2 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_2_2.show();});^M
       });
     }

@@ -526,6 +581,11 @@
       }, function(response) {
         console.log("step 3 apply fail");
         vm.step_3.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 3 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_3.show();});^M
       });
     };

@@ -606,6 +666,11 @@
       }, function(response) {
         console.log("step 4 apply fail");
         vm.step_4.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 4 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_4.show();});^M
       });
     };

@@ -651,6 +716,11 @@
       }, function(response) {
         console.log("step 5 apply fail");
         vm.step_5.apply_status = "Apply fail";
+        swal({^M
+          title:"Apply fail",^M
+          text: "Please go to step 5 to modify your setting!",^M
+          type:"error",^M
+        }, function(){vm.step_5.show();});^M
       });
     };

image

1530

回到 M300 branch feature/lighttpd

⚠️ **GitHub.com Fallback** ⚠️