20190510_jeffrey - silenceuncrio/diary GitHub Wiki

0910

review

昨天遇到不少問點

先回到最後一次的 commit 再 build 一次 image

然後試著來釐清問題

0940

最後一次 commit 版本

在 pwd = /www/fcgi-bin/ 的位置新增一個 go.sh

#!/bin/bash

killall lighttpd
tftp -g -r iweb.fcgi 192.168.1.113
lighttpd -f /home/factory/icos/lighttpd/lighttpd.conf

執行該 script 來啟動 loghttpd

chrome 打開 debug Mode 就看到一個 status.cgi?act=top 出現 500 - Internal Server Error

後續由 javascript 每十秒發一次的 status.cgi?act=top 就正常了

關掉無痕視窗再重開一次

這時候就沒看到 status.cgi?act=top 出現 500 - Internal Server Error

點選 System > Time and Date

對應的 javascript 觸發以下 HTTP request

  • /api/whoAmI?uuid=[0-9.]+
  • /cgi-bin/sntp.cgi?act=config
  • /cgi-bin/sntp.cgi?act=help

會發現這個畫面開不起來

然後 javascript 持續的重試

image

出現 500 - Internal Server Error 的 request 並沒有特定是哪一個

1300

寫週報先

盤一下這禮拜做的

  • M300 - feature/lighttpd
    • 之前 cgi 使用的 jweb api 可以繼續使用
    • 不過有些地方需要修改
    • porting status.cgi
    • use lighttpd url rewrites to rewrite cgi-related request to fcgi-related request, for ex.
      • before rewrite: REQUEST_URI="/cgi-bin/status.cgi?act=status"
      • after rewrite: REQUEST_URI="/fcgi-bin/iweb.fcgi?app=status&act=status"
    • porting sntp.cgi
    • porting /api/whoAmI
    • use cgi_init_values() to get cookie into jweb.in.session;
    • then whoAmI() can according to this value to responce as previous iweb
    • implement the basic access control for app=sntp:
    • let /api/whoAmI?uuid=0.xxxx and /api/login apply the same rule of "URL rewrite"
    • issue - 500 - Internal Server Error
  • M330
    • customize the web ui for customer CTCU with BRAND_ID 12

1340

試著改寫 icos.service.js

先讓 lighttpd 不要使用 url rewrite 的功能

看看是否一樣有 500 - Internal Server Error 的問題

diff --git a/proscend/base_fs/default/rootfs/home/factory/icos/lighttpd/lighttpd.conf b/proscend/base_fs/default/rootfs/home/factory/icos/lighttpd/lighttpd.conf
index 7fa218a..1abed5e 100644
--- a/proscend/base_fs/default/rootfs/home/factory/icos/lighttpd/lighttpd.conf
+++ b/proscend/base_fs/default/rootfs/home/factory/icos/lighttpd/lighttpd.conf
@@ -12,7 +12,7 @@
 # - saves some time
 # - saves memory
 server.modules              = (
-                                "mod_rewrite",
+#                               "mod_rewrite",
 #                               "mod_redirect",
 #                               "mod_alias",
                                 "mod_access",
diff --git a/proscend/prosrc/fcgi/app_sntp.c b/proscend/prosrc/fcgi/app_sntp.c
index d17609e..e01361a 100644
--- a/proscend/prosrc/fcgi/app_sntp.c
+++ b/proscend/prosrc/fcgi/app_sntp.c
@@ -394,7 +394,7 @@ void app_sntp(void)
     if      (STRCMP(jweb.in.act, "config"))
     {
         //_config();
-        access_control(ATTVAL_SYSTEM_LEVEL2, _config);
+        access_control(ATTVAL_SYSTEM_LEVEL1, _config);
     }
     else if (STRCMP(jweb.in.act, "apply"))
     {
diff --git a/proscend/prosrc/www/app/services/icos.service.js b/proscend/prosrc/www/app/services/icos.service.js
index 2b3fa46..ff67e04 100644
--- a/proscend/prosrc/www/app/services/icos.service.js
+++ b/proscend/prosrc/www/app/services/icos.service.js
@@ -273,16 +273,20 @@ function icos($http) {

     var sntp = {};
     sntp.config = function() {
-        return $http.get('cgi-bin/sntp.cgi?act=config');
+        //return $http.get('cgi-bin/sntp.cgi?act=config');
+        return $http.get('fcgi-bin/iweb.fcgi?app=sntp&act=config');
     };
     sntp.help = function() {
-        return $http.get('cgi-bin/sntp.cgi?act=help');
+        //return $http.get('cgi-bin/sntp.cgi?act=help');
+        return $http.get('fcgi-bin/iweb.fcgi?app=sntp&act=help');
     };
     sntp.apply = function(config) {
-        return $http.post('cgi-bin/sntp.cgi?act=apply', angular.copy(config));
+        //return $http.post('cgi-bin/sntp.cgi?act=apply', angular.copy(config));
+        return $http.post('fcgi-bin/iweb.fcgi?app=sntp&act=apply', angular.copy(config));
     }
     sntp.set = function(config) {
-        return $http.post('cgi-bin/sntp.cgi?act=set', angular.copy(config));
+        //return $http.post('cgi-bin/sntp.cgi?act=set', angular.copy(config));
+        return $http.post('fcgi-bin/iweb.fcgi?app=sntp&act=set', angular.copy(config));
     }
     factory.sntp = sntp;

@@ -997,7 +1001,8 @@ function icos($http) {

     var api = {};
     api.whoAmI = function() {
-        return $http.get('api/whoAmI?uuid=' + Math.random());
+        //return $http.get('api/whoAmI?uuid=' + Math.random());
+        return $http.get('/fcgi-bin/iweb.fcgi?app=api&act=whoAmI&uuid=' + Math.random());
     }
     factory.api = api;

@@ -1045,10 +1050,12 @@ function icos($http) {

     var status = {}
     status.status = function() {
-        return $http.get('cgi-bin/status.cgi?act=status');
+        //return $http.get('cgi-bin/status.cgi?act=status');
+        return $http.get('fcgi-bin/iweb.fcgi?app=status&act=status');
     }
     status.top = function() {
-        return $http.get('cgi-bin/status.cgi?act=top');
+        //return $http.get('cgi-bin/status.cgi?act=top');
+        return $http.get('fcgi-bin/iweb.fcgi?app=status&act=top');
     }
     factory.status = status;

殘念

看來不是 url rewrite 的問題

image

現在的重點是我願意為了 fast cgi 付出多少時間來排除現再遇到的狀況

單純只使用 lighttpd 的 cgi 時

image

看來下禮拜先捨棄 fast cgi 好了

先求有