20190716_jeffrey - silenceuncrio/diary GitHub Wiki

0850

繼續分析 cgilib 的問題

1400

找到 cgilib 的問題並解決了

解決的關鍵如下

diff --git a/proscend/prosrc/webcgi/cgilib-0.7/aux_x.c b/proscend/prosrc/webcgi/cgilib-0.7/aux_x.c
index d0bf6fe..81f8ac6 100644
--- a/proscend/prosrc/webcgi/cgilib-0.7/aux_x.c
+++ b/proscend/prosrc/webcgi/cgilib-0.7/aux_x.c
@@ -206,8 +206,9 @@ char *cgiGetLine (FILE *stream)
     cgiDebugOutput(2, "[%s:%d] Reading file ...\n", __FUNCTION__, __LINE__);
     while (!feof (stream)) {
                cgiDebugOutput(2, "[%s:%d] Reading ...\n", __FUNCTION__, __LINE__);
-               if ((cp = pfgets0(buf, sizeof (buf), stream)) == NULL) {
-                       //if ((cp = fgets(buf, sizeof (buf), stream)) == NULL) {
+
+        //if ((cp = pfgets0(buf, sizeof (buf), stream)) == NULL) {
+        if ((cp = fgets(buf, sizeof (buf), stream)) == NULL) {
                        cgiDebugOutput(2, "[%s:%d] Reading ... No data!!! errno:%d\n", __FUNCTION__, __LINE__, errno);
                        return NULL;
                }

pfgets0 並不是原本 source code 有的

找一下 M300 的 git 紀錄也看不到修改的紀錄

很有可能是 M300 專案一成立時就有了

這個緣由後續有時間再追

1530

M300 - develop - offer CGI for batch upload used by openvpn

commit 9bee8d6518e1d4cbd52e7278108a523649c50976
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Tue Jul 16 15:29:51 2019 +0800

    offer CGI for batch upload used by openvpn
    - openvpnBatchUpload - POST /cgi-bin/api/cgi?act=openvpnBatchUpload
      - before rewrite - api/openvpnBatchUpload
      - jweb need further handle when REQUEST_METHOD="POST" and QUERY_STRING="act=openvpnBatchUpload"

    correct aux_x.c for libcgi at cgiGetLine()
    - or multiple files upload will be failed
    - no idea who write the pfgets0() function and why use pfgets0() instead of fgets()

 proscend/prosrc/webcgi/api.c               |   17 +
 proscend/prosrc/webcgi/cgilib-0.7/aux_x.c  |  319 +++---
 proscend/prosrc/webcgi/cgilib-0.7/cgi.c    | 1520 +++++++++++++++++-----------
 proscend/prosrc/webcgi/jweb.c              |  110 ++
 proscend/prosrc/webcgi/jweb.h              |    8 +
 proscend/prosrc/www/app/feature/openvpn.js |    2 +-
 6 files changed, 1236 insertions(+), 740 deletions(-)

M300 - develop - remove the debug information from api_openvpn_batch_upload()

ccommit e8b159acc380fcbc145b9939bc466e6525ad11d4
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Tue Jul 16 15:52:07 2019 +0800

    remove the debug information from api_openvpn_batch_upload()

 proscend/prosrc/webcgi/jweb.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)